{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wildflower.computer/schemas/sandbox-cost-snapshot-v2.schema.json",
  "title": "Wildflower sandbox cost snapshot v2",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "eventName",
    "eventId",
    "capturedAtUnixMs",
    "projectId",
    "sandboxId",
    "provider",
    "snapshotReason",
    "costFidelity",
    "confidence",
    "observedWallTimeMilliseconds",
    "listPriceEstimateUsd",
    "providerReportedStatus",
    "providerReportedAmountUsd",
    "providerReportedReason",
    "invoiceReconciledStatus",
    "invoiceReconciledAmountUsd",
    "invoiceReconciledReason",
    "priceSourceUrl",
    "priceSourceDigest",
    "priceSourceBasis"
  ],
  "properties": {
    "schemaVersion": {
      "const": "wildflower.telemetry.sandbox-cost-snapshot.v2"
    },
    "eventName": {
      "const": "wildflower.sandbox.cost_snapshot.captured"
    },
    "eventId": {
      "type": "string",
      "format": "uuid"
    },
    "capturedAtUnixMs": {
      "type": "integer"
    },
    "projectId": {
      "type": [
        "integer",
        "null"
      ],
      "minimum": 1
    },
    "sandboxId": {
      "type": "string",
      "minLength": 1
    },
    "provider": {
      "enum": [
        "agentcore",
        "blaxel",
        "box",
        "cloudflare",
        "e2b",
        "novita",
        "daytona",
        "modal",
        "runloop",
        "smol",
        "sprites",
        "vercel"
      ]
    },
    "snapshotReason": {
      "enum": [
        "sandbox_created",
        "cost_requested",
        "sandbox_deleted"
      ]
    },
    "costFidelity": {
      "enum": [
        "list_price_estimate",
        "provider_reported",
        "invoice_reconciled",
        "unavailable"
      ]
    },
    "confidence": {
      "const": "low"
    },
    "observedWallTimeMilliseconds": {
      "type": "integer",
      "minimum": 0
    },
    "listPriceEstimateUsd": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9]+\\.[0-9]{6}$"
    },
    "providerReportedStatus": {
      "const": "unavailable"
    },
    "providerReportedAmountUsd": {
      "type": "null"
    },
    "providerReportedReason": {
      "type": "string",
      "minLength": 1
    },
    "invoiceReconciledStatus": {
      "const": "unavailable"
    },
    "invoiceReconciledAmountUsd": {
      "type": "null"
    },
    "invoiceReconciledReason": {
      "type": "string",
      "minLength": 1
    },
    "priceSourceUrl": {
      "type": "string",
      "format": "uri"
    },
    "priceSourceDigest": {
      "type": "string",
      "pattern": "^[a-f0-9]{64}$"
    },
    "priceSourceBasis": {
      "enum": [
        "sandbox_creation_snapshot",
        "current_catalog_fallback"
      ]
    }
  }
}
