{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://any.health/contracts/coverage.state/1/request.schema.json",
  "title": "Coverage State draft family request",
  "description": "Draft request shape published for design discussion. No compatibility promise is made.",
  "x-any-maturity": "draft",
  "x-any-scope": "family",
  "type": "object",
  "required": ["subject_ref", "effective_at", "intent"],
  "properties": {
    "subject_ref": {
      "type": "object",
      "required": ["namespace", "id"],
      "properties": {
        "namespace": { "type": "string", "minLength": 1 },
        "id": { "type": "string", "minLength": 1 }
      },
      "additionalProperties": false
    },
    "effective_at": { "type": "string", "format": "date-time" },
    "evidence_as_of": { "type": "string", "format": "date-time" },
    "intent": {
      "enum": ["eligibility", "benefit", "network_route", "cost_context", "member_service", "payment_review_context", "gap_analysis"]
    },
    "care_context": {
      "type": "object",
      "properties": {
        "service_codes": {
          "type": "array",
          "items": {
            "type": "object",
            "required": ["system", "code"],
            "properties": {
              "system": { "type": "string" },
              "code": { "type": "string" }
            },
            "additionalProperties": false
          }
        },
        "place_of_service": {
          "type": "object",
          "required": ["system", "code"],
          "properties": {
            "system": { "type": "string" },
            "code": { "type": "string" }
          },
          "additionalProperties": false
        },
        "service_location_ref": { "type": "string" }
      },
      "additionalProperties": false
    },
    "provider_context": {
      "type": "object",
      "properties": {
        "provider_ref": { "type": "string" },
        "npi": { "type": "string", "pattern": "^[0-9]{10}$" },
        "location_ref": { "type": "string" }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
