{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://marroccofella-ops.github.io/manx-sailings/data/timetable.schema.json",
  "title": "Manx Sailings published timetable v1",
  "type": "array",
  "minItems": 1,
  "items": {
    "type": "object",
    "required": [
      "id",
      "date",
      "from",
      "to",
      "departure",
      "arrival",
      "arrival_date",
      "vessel",
      "duration",
      "duration_basis",
      "source",
      "source_id",
      "extraction_date",
      "review_date",
      "status",
      "notes",
      "actions"
    ],
    "additionalProperties": false,
    "properties": {
      "id": {
        "type": "string"
      },
      "date": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "from": {
        "enum": [
          "Isle of Man",
          "Liverpool",
          "Heysham",
          "Larne"
        ]
      },
      "to": {
        "enum": [
          "Isle of Man",
          "Liverpool",
          "Heysham",
          "Larne"
        ]
      },
      "departure": {
        "type": "string",
        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
      },
      "arrival": {
        "type": "string",
        "pattern": "^([01]\\d|2[0-3]):[0-5]\\d$"
      },
      "arrival_date": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "vessel": {
        "enum": [
          "Manannan",
          "Ben My Chree"
        ]
      },
      "duration": {
        "type": "string",
        "pattern": "^PT[0-9]+H[0-9]+M$"
      },
      "duration_basis": {
        "const": "published_local_clock_difference"
      },
      "source": {
        "type": "string"
      },
      "source_id": {
        "type": "string"
      },
      "extraction_date": {
        "type": [
          "string",
          "null"
        ]
      },
      "review_date": {
        "type": "string",
        "pattern": "^\\d{4}-\\d{2}-\\d{2}$"
      },
      "status": {
        "const": "published_schedule"
      },
      "notes": {
        "type": "array",
        "items": {
          "type": "string"
        }
      },
      "actions": {
        "type": "object",
        "required": [
          "check_live_status",
          "book",
          "amend"
        ],
        "additionalProperties": false,
        "properties": {
          "check_live_status": {
            "type": "string"
          },
          "book": {
            "type": "string"
          },
          "amend": {
            "type": "string"
          }
        }
      }
    }
  }
}
