{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/tilwhen-com/json-schema/tilwhen-com-parse-result-schema.json",
  "title": "ParseResult",
  "x-generated": "2026-11-26",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/tilwhen-com-openapi.json#/components/schemas/ParseResult",
  "type": "object",
  "properties": {
    "parsed": {
      "type": [
        "object",
        "null"
      ]
    },
    "confidence": {
      "type": "number"
    },
    "warnings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "needsClarification": {
      "type": "object"
    },
    "canonicalPath": {
      "type": [
        "string",
        "null"
      ]
    },
    "answer": {
      "type": "object"
    },
    "receipt": {
      "$ref": "#/$defs/Receipt"
    }
  },
  "$defs": {
    "Receipt": {
      "type": "object",
      "description": "Auditable calculation record; field order in serialized responses is stable.",
      "properties": {
        "id": {
          "type": "string",
          "pattern": "^tw1-[0-9a-f]{16}$"
        },
        "query": {
          "type": "object"
        },
        "resolved": {
          "type": "object",
          "additionalProperties": {
            "type": "string"
          }
        },
        "answer": {
          "type": "object"
        },
        "timezone": {
          "type": "string"
        },
        "convention": {
          "type": "string",
          "const": "exclusive-today-is-day-0"
        },
        "workweek": {
          "$ref": "#/$defs/Workweek"
        },
        "jurisdiction": {
          "type": [
            "string",
            "null"
          ]
        },
        "customHolidays": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "holidaysExcluded": {
          "type": "array",
          "description": "Itemised excluded holidays, capped at 500; see holidaysExcludedCount for the true total.",
          "items": {
            "type": "object",
            "properties": {
              "name": {
                "type": "string"
              },
              "dateISO": {
                "type": "string"
              }
            }
          }
        },
        "holidaysExcludedCount": {
          "type": "integer",
          "description": "Total holidays excluded by the calculation. Exceeds holidaysExcluded.length on very wide spans, where a holiday_list_truncated warning also appears."
        },
        "computedAt": {
          "type": "string",
          "format": "date-time"
        },
        "validFor": {
          "type": "string",
          "format": "date"
        },
        "engineVersion": {
          "type": "string"
        },
        "holidayDatasetVersion": {
          "type": "string"
        },
        "warnings": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            }
          }
        },
        "sources": {
          "type": "array",
          "items": {
            "type": "object",
            "properties": {
              "title": {
                "type": "string"
              },
              "url": {
                "type": "string"
              },
              "publisher": {
                "type": "string"
              },
              "retrievedAt": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "Workweek": {
      "type": "string",
      "enum": [
        "mon-fri",
        "sun-thu",
        "mon-sat"
      ]
    }
  }
}