{
  "$schema": "http://json-schema.org/draft-07/schema#",
  "$id": "https://wherewhen.co/tz-edge-cases/schema.json",
  "title": "Timezone edge-case fixture corpus",
  "type": "object",
  "required": [
    "corpus",
    "version",
    "tzdataVersion",
    "cases"
  ],
  "properties": {
    "corpus": {
      "const": "tz-edge-cases"
    },
    "version": {
      "type": "string",
      "description": "Semver of the corpus itself, independent of tzdataVersion."
    },
    "tzdataVersion": {
      "type": "string",
      "pattern": "^[0-9]{4}[a-z]$",
      "description": "IANA release the expected values were computed against, e.g. 2026c."
    },
    "generatedAt": {
      "type": "string",
      "format": "date-time"
    },
    "notes": {
      "type": "string"
    },
    "counts": {
      "type": "object"
    },
    "cases": {
      "type": "array",
      "items": {
        "$ref": "#/definitions/case"
      }
    }
  },
  "definitions": {
    "case": {
      "type": "object",
      "required": [
        "id",
        "category",
        "stability",
        "description",
        "input",
        "expected"
      ],
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^[a-z0-9-]+$",
          "description": "Stable identifier. Never reused or renumbered."
        },
        "category": {
          "enum": [
            "gap",
            "ambiguous",
            "sub_hour_offset",
            "inverted_dst",
            "negative_dst",
            "zero_offset_transition",
            "offset_move",
            "rule_change",
            "skipped_date",
            "intra_country",
            "lmt",
            "conversion"
          ]
        },
        "stability": {
          "enum": [
            "frozen",
            "volatile"
          ],
          "description": "frozen: past instant, answer never changes. volatile: future instant, must be re-verified each tzdata release."
        },
        "description": {
          "type": "string"
        },
        "input": {
          "oneOf": [
            {
              "type": "object",
              "required": [
                "localDateTime",
                "zone"
              ],
              "properties": {
                "localDateTime": {
                  "type": "string",
                  "description": "Naive local wall-clock time, no offset. May not exist."
                },
                "zone": {
                  "type": "string",
                  "description": "IANA zone identifier."
                }
              },
              "additionalProperties": false
            },
            {
              "type": "object",
              "required": [
                "localDateTime",
                "fromZone",
                "toZone"
              ],
              "properties": {
                "localDateTime": {
                  "type": "string"
                },
                "fromZone": {
                  "type": "string"
                },
                "toZone": {
                  "type": "string"
                },
                "fold": {
                  "type": "integer",
                  "enum": [
                    0,
                    1
                  ],
                  "description": "Which occurrence to use when the source local time is ambiguous (PEP 495 semantics)."
                }
              },
              "additionalProperties": false
            }
          ]
        },
        "expected": {
          "type": "object",
          "description": "Shape depends on category; see README.",
          "properties": {
            "exists": {
              "type": "boolean"
            },
            "occurrences": {
              "type": "integer",
              "minimum": 0,
              "maximum": 2
            },
            "gapStart": {
              "type": "string"
            },
            "gapEnd": {
              "type": "string"
            },
            "gapMinutes": {
              "type": "number"
            },
            "resolutions": {
              "type": "object"
            },
            "ambiguityStart": {
              "type": "string"
            },
            "ambiguityEnd": {
              "type": "string"
            },
            "first": {
              "type": "object"
            },
            "second": {
              "type": "object"
            },
            "instantUtc": {
              "type": "string"
            },
            "utcOffset": {
              "type": "string"
            },
            "utcOffsetMinutes": {
              "type": "number"
            },
            "abbreviation": {
              "type": [
                "string",
                "null"
              ]
            },
            "isDst": {
              "type": "boolean"
            },
            "fromUtcOffset": {
              "type": "string"
            },
            "toUtcOffset": {
              "type": "string"
            },
            "toLocalDateTime": {
              "type": "string"
            },
            "offsetDeltaMinutes": {
              "type": "number"
            },
            "dayShift": {
              "type": "integer"
            }
          }
        },
        "volatileReason": {
          "type": [
            "string",
            "null"
          ],
          "enum": [
            "future_rules",
            "pre_1970_build_variance",
            null
          ],
          "description": "Why a volatile case may differ: pending government decree, or tzdb's lack of stability guarantees for pre-1970 data."
        }
      },
      "additionalProperties": false
    }
  }
}
