{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://wildflower.computer/schemas/provider-observability-coverage.schema.json",
  "title": "Wildflower provider observability coverage",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "capturedAt", "warning", "providers"],
  "properties": {
    "schemaVersion": { "const": 1 },
    "capturedAt": { "type": "string", "format": "date-time" },
    "warning": { "type": "string", "minLength": 1 },
    "providers": {
      "type": "array",
      "minItems": 1,
      "items": { "$ref": "#/$defs/provider" }
    }
  },
  "$defs": {
    "provider": {
      "type": "object",
      "additionalProperties": false,
      "required": ["provider", "authentication", "latency", "usage", "cost"],
      "properties": {
        "provider": { "type": "string", "minLength": 1 },
        "authentication": { "$ref": "#/$defs/authentication" },
        "latency": { "$ref": "#/$defs/latency" },
        "usage": { "$ref": "#/$defs/usage" },
        "cost": { "$ref": "#/$defs/cost" }
      }
    },
    "authentication": {
      "type": "object",
      "additionalProperties": false,
      "required": ["safeProbe", "deepProbe", "liveVerified"],
      "properties": {
        "safeProbe": { "const": "profile_only" },
        "deepProbe": { "const": "create_get_exec_delete" },
        "liveVerified": { "type": "boolean" }
      }
    },
    "latency": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "wildflowerOperationTiming",
        "insideSandboxTiming",
        "providerPhaseBreakdown"
      ],
      "properties": {
        "wildflowerOperationTiming": { "type": "boolean" },
        "insideSandboxTiming": { "type": "boolean" },
        "providerPhaseBreakdown": { "type": "boolean" }
      }
    },
    "usage": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "sourceKind",
        "implementationStatus",
        "granularity",
        "lag",
        "sourceUrl",
        "requiredAccess",
        "missing"
      ],
      "properties": {
        "sourceKind": { "type": "string", "minLength": 1 },
        "implementationStatus": {
          "enum": [
            "additional_credentials_required",
            "additional_scope_required",
            "estimate_only",
            "provider_signal_not_integrated",
            "unsupported_per_sandbox"
          ]
        },
        "granularity": { "type": "string", "minLength": 1 },
        "lag": { "type": "string", "minLength": 1 },
        "sourceUrl": { "type": "string", "format": "uri" },
        "requiredAccess": {
          "type": "array",
          "items": { "type": "string", "minLength": 1 }
        },
        "missing": {
          "type": "array",
          "minItems": 1,
          "items": { "type": "string", "minLength": 1 }
        }
      }
    },
    "cost": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "providerReportedAvailable",
        "invoiceReconciliationAvailable",
        "listPriceEstimateAvailable",
        "reason"
      ],
      "properties": {
        "providerReportedAvailable": { "type": "boolean" },
        "invoiceReconciliationAvailable": { "type": "boolean" },
        "listPriceEstimateAvailable": { "type": "boolean" },
        "reason": { "type": "string", "minLength": 1 }
      }
    }
  }
}
