{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://petcostplanner.com/data/reference-estimates-schema-v1.json",
  "title": "Pet Cost Planner reference estimates schema",
  "description": "Validation contract for reference-estimates-v1.json.",
  "type": "object",
  "required": [
    "schemaVersion",
    "dataset",
    "scenario",
    "records"
  ],
  "properties": {
    "schemaVersion": {
      "type": "string",
      "const": "1.0"
    },
    "dataset": {
      "type": "object",
      "required": [
        "id",
        "name",
        "version",
        "modelVersion",
        "datePublished",
        "dateModified",
        "recordCount",
        "currency",
        "methodology",
        "schema",
        "license",
        "citation",
        "disclaimer"
      ],
      "properties": {
        "id": {
          "type": "string",
          "format": "uri"
        },
        "name": {
          "type": "string"
        },
        "version": {
          "type": "string",
          "const": "1.0.0"
        },
        "modelVersion": {
          "type": "string",
          "const": "1.0.0"
        },
        "datePublished": {
          "type": "string",
          "format": "date"
        },
        "dateModified": {
          "type": "string",
          "format": "date"
        },
        "recordCount": {
          "type": "integer",
          "const": 208
        },
        "currency": {
          "type": "string",
          "const": "USD"
        },
        "methodology": {
          "type": "string",
          "format": "uri"
        },
        "schema": {
          "type": "string",
          "format": "uri"
        },
        "license": {
          "type": "string",
          "format": "uri"
        },
        "citation": {
          "type": "string"
        },
        "disclaimer": {
          "type": "string"
        }
      }
    },
    "scenario": {
      "type": "object",
      "required": [
        "id",
        "label",
        "petCount",
        "lifeStage",
        "insuranceIncluded",
        "setupIncluded",
        "dentalIncluded",
        "boardingNights",
        "grooming",
        "horizonYears",
        "emergencySavingsIncluded",
        "interpretation"
      ]
    },
    "records": {
      "type": "array",
      "minItems": 208,
      "maxItems": 208,
      "items": {
        "type": "object",
        "required": [
          "id",
          "location",
          "petType",
          "dogSize",
          "currency",
          "annual",
          "monthly",
          "range",
          "firstYear",
          "tenYearFlatDollarScenario",
          "localFactors",
          "categories"
        ],
        "properties": {
          "id": {
            "type": "string"
          },
          "location": {
            "type": "string"
          },
          "petType": {
            "enum": [
              "dog",
              "cat"
            ]
          },
          "dogSize": {
            "type": [
              "string",
              "null"
            ],
            "enum": [
              "small",
              "medium",
              "large",
              null
            ]
          },
          "currency": {
            "const": "USD"
          },
          "annual": {
            "type": "number",
            "minimum": 0
          },
          "monthly": {
            "type": "number",
            "minimum": 0
          },
          "range": {
            "type": "object",
            "required": [
              "annualLow",
              "annualHigh",
              "monthlyLow",
              "monthlyHigh",
              "statisticalConfidenceInterval"
            ]
          },
          "firstYear": {
            "type": "number",
            "minimum": 0
          },
          "tenYearFlatDollarScenario": {
            "type": "number",
            "minimum": 0
          },
          "localFactors": {
            "type": "object",
            "required": [
              "goods",
              "services"
            ]
          },
          "categories": {
            "type": "array",
            "minItems": 1,
            "items": {
              "type": "object",
              "required": [
                "key",
                "label",
                "annual"
              ],
              "properties": {
                "key": {
                  "type": "string"
                },
                "label": {
                  "type": "string"
                },
                "annual": {
                  "type": "number",
                  "minimum": 0
                }
              }
            }
          }
        }
      }
    }
  }
}
