{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/sweetsaverfare-com/json-schema/sweetsaverfare-com-fare-history-response-schema.json",
  "title": "FareHistoryResponse",
  "x-generated": "2026-11-25",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/_original/sweetsaverfare-com-api-openapi.json#/components/schemas/FareHistoryResponse",
  "allOf": [
    {
      "type": "object",
      "required": [
        "observation_id",
        "observed_at",
        "stale_after",
        "freshness_state",
        "source_status",
        "data_source",
        "parser_version",
        "observation_trace_id",
        "fixture_sha",
        "disclaimer"
      ],
      "properties": {
        "observation_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid"
        },
        "observed_at": {
          "type": "string",
          "format": "date-time"
        },
        "stale_after": {
          "type": "string",
          "format": "date-time"
        },
        "freshness_state": {
          "type": "string",
          "enum": [
            "fresh",
            "stale",
            "expired"
          ]
        },
        "source_status": {
          "type": "string",
          "enum": [
            "ok",
            "missing",
            "provider_queue_active",
            "session_expired",
            "blocked",
            "unknown"
          ]
        },
        "data_source": {
          "type": "string",
          "enum": [
            "demo",
            "fake_worker",
            "fixture",
            "live_provider",
            "schedule_reference"
          ]
        },
        "parser_version": {
          "type": "string"
        },
        "observation_trace_id": {
          "type": [
            "string",
            "null"
          ]
        },
        "fixture_sha": {
          "type": [
            "string",
            "null"
          ]
        },
        "observation_outcome": {
          "type": "string",
          "enum": [
            "verified",
            "partial",
            "unavailable",
            "failed"
          ]
        },
        "disclaimer": {
          "type": "string",
          "const": "Ferry fares can change. Confirm final availability and price directly with BC Ferries before making travel decisions."
        }
      }
    },
    {
      "type": "object",
      "required": [
        "route_id",
        "profile_id",
        "travel_date",
        "route_advisory",
        "price_history"
      ],
      "properties": {
        "route_id": {
          "type": "string",
          "enum": [
            "TSA_SWB",
            "SWB_TSA",
            "TSA_DUK",
            "DUK_TSA",
            "TSA_NAN",
            "HSB_NAN",
            "NAN_HSB",
            "SWB_FUL",
            "FUL_SWB",
            "HSB_LNG",
            "LNG_HSB",
            "ERL_SLT",
            "SLT_ERL",
            "CMX_PWR",
            "PWR_CMX"
          ]
        },
        "profile_id": {
          "type": "string",
          "enum": [
            "ADULT_NO_VEHICLE",
            "ADULT_STANDARD_VEHICLE",
            "ADULT_OVERHEIGHT_VEHICLE"
          ]
        },
        "travel_date": {
          "type": "string",
          "format": "date"
        },
        "route_advisory": {
          "anyOf": [
            {
              "$ref": "#/$defs/RouteAdvisory"
            },
            {
              "type": "null"
            }
          ]
        },
        "price_history_included": {
          "type": "boolean",
          "const": true,
          "description": "History is included by this endpoint."
        },
        "price_history": {
          "type": "array",
          "items": {
            "$ref": "#/$defs/PriceHistoryPoint"
          }
        }
      }
    }
  ],
  "$defs": {
    "PriceHistoryPoint": {
      "type": "object",
      "required": [
        "observed_at",
        "price_cents"
      ],
      "properties": {
        "departure_time": {
          "type": "string",
          "pattern": "^([01][0-9]|2[0-3]):[0-5][0-9]$"
        },
        "observed_at": {
          "type": "string",
          "format": "date-time"
        },
        "price_cents": {
          "type": "integer",
          "minimum": 0
        },
        "fare_options": {
          "type": "array",
          "items": {
            "type": "object",
            "required": [
              "fare_family",
              "price_cents",
              "available"
            ],
            "properties": {
              "fare_family": {
                "type": "string",
                "enum": [
                  "SAVER",
                  "PREPAID",
                  "RESERVATION_ONLY",
                  "STANDARD"
                ]
              },
              "price_cents": {
                "type": [
                  "integer",
                  "null"
                ],
                "minimum": 0
              },
              "available": {
                "type": "boolean"
              },
              "price_breakdown": {
                "type": "array",
                "items": {
                  "type": "object",
                  "required": [
                    "label",
                    "price_cents"
                  ],
                  "properties": {
                    "label": {
                      "type": "string"
                    },
                    "price_cents": {
                      "type": "integer"
                    }
                  }
                }
              }
            }
          }
        },
        "saver_price_cents": {
          "type": [
            "integer",
            "null"
          ],
          "minimum": 0
        }
      }
    },
    "RouteAdvisory": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "message",
        "source_url",
        "reviewed_at"
      ],
      "properties": {
        "message": {
          "type": "string"
        },
        "source_url": {
          "type": "string",
          "format": "uri"
        },
        "reviewed_at": {
          "type": "string",
          "format": "date"
        }
      }
    }
  }
}