{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wildflower.computer/schemas/provider-benchmark-result-v1.schema.json",
  "title": "Wildflower provider benchmark result v1",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "runId",
    "status",
    "startedAt",
    "completedAt",
    "manifest",
    "methodology",
    "rawSamples",
    "lifecycle",
    "summary",
    "warnings"
  ],
  "properties": {
    "schemaVersion": {
      "const": "wildflower.provider-benchmark.v1"
    },
    "runId": {
      "type": "string",
      "format": "uuid"
    },
    "status": {
      "enum": [
        "running",
        "completed",
        "interrupted",
        "failed"
      ]
    },
    "startedAt": {
      "type": "string",
      "format": "date-time"
    },
    "completedAt": {
      "type": [
        "string",
        "null"
      ],
      "format": "date-time"
    },
    "manifest": {
      "type": "object"
    },
    "methodology": {
      "type": "object"
    },
    "rawSamples": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/sample"
      }
    },
    "lifecycle": {
      "type": "array",
      "items": {
        "type": "object"
      }
    },
    "summary": {
      "type": [
        "object",
        "null"
      ]
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "failure": {
      "$ref": "#/$defs/failure"
    }
  },
  "$defs": {
    "failure": {
      "type": [
        "object",
        "null"
      ],
      "required": [
        "name",
        "message"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "message": {
          "type": "string"
        }
      }
    },
    "sample": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sampleId",
        "cohort",
        "provider",
        "workload",
        "round",
        "outcome",
        "operations",
        "insideSandbox",
        "wallTotalMicroseconds",
        "applicationTotalMicroseconds",
        "providerTotalMicroseconds",
        "listPriceEstimateUsd",
        "usage",
        "failure",
        "cleanup"
      ],
      "properties": {
        "sampleId": {
          "type": "string",
          "format": "uuid"
        },
        "cohort": {
          "enum": [
            "cold",
            "warm"
          ]
        },
        "provider": {
          "type": "string"
        },
        "workload": {
          "enum": [
            "noop",
            "shell_cpu",
            "filesystem_cache",
            "filesystem_durable"
          ]
        },
        "round": {
          "type": "integer",
          "minimum": 0
        },
        "outcome": {
          "enum": [
            "succeeded",
            "failed"
          ]
        },
        "operations": {
          "type": "object"
        },
        "insideSandbox": {
          "type": "object",
          "additionalProperties": false,
          "required": [
            "status",
            "microseconds",
            "resolutionMicroseconds",
            "clock"
          ],
          "properties": {
            "status": {
              "enum": [
                "measured",
                "unavailable"
              ]
            },
            "microseconds": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 0
            },
            "resolutionMicroseconds": {
              "type": [
                "integer",
                "null"
              ],
              "minimum": 1
            },
            "clock": {
              "enum": [
                "proc_uptime",
                null
              ]
            }
          }
        },
        "wallTotalMicroseconds": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "applicationTotalMicroseconds": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "providerTotalMicroseconds": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        },
        "listPriceEstimateUsd": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^[0-9]+\\.[0-9]{6}$"
        },
        "usage": {
          "type": [
            "object",
            "null"
          ]
        },
        "usageFailure": {
          "$ref": "#/$defs/failure"
        },
        "failure": {
          "$ref": "#/$defs/failure"
        },
        "cleanup": {
          "type": "object"
        }
      }
    }
  }
}
