{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "urn:travel-esim-plans:v1",
  "title": "Travel eSIM plans feed, version 1",
  "description": "Read-only list of every plan that can be bought online. Prices are final consumer prices including VAT. Generated at build time from the same price list as the website and the checkout.",
  "type": "object",
  "required": [
    "apiVersion",
    "updatedAt",
    "dataVersion",
    "provider",
    "currencies",
    "pricesIncludeVat",
    "esimFee",
    "destinations",
    "plans"
  ],
  "properties": {
    "apiVersion": {
      "const": 1
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "description": "When the content last changed (not when the file was last built)."
    },
    "dataVersion": {
      "type": "string",
      "description": "Content fingerprint. Unchanged value = nothing to update."
    },
    "schema": {
      "type": "string",
      "description": "Path of this schema on the API (GET /v1/schema)."
    },
    "provider": {
      "type": "object",
      "required": [
        "name",
        "website"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "website": {
          "type": "string",
          "format": "uri"
        },
        "contact": {
          "type": "string"
        }
      }
    },
    "currencies": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/currency"
      },
      "minItems": 1
    },
    "pricesIncludeVat": {
      "type": "boolean"
    },
    "esimFee": {
      "type": "object",
      "description": "One-time fee for a new eSIM profile, charged on top of the plan price. Not charged between waived.from and waived.until.",
      "required": [
        "amount",
        "appliesTo"
      ],
      "properties": {
        "amount": {
          "$ref": "#/$defs/prices"
        },
        "appliesTo": {
          "type": "string"
        },
        "waived": {
          "type": [
            "object",
            "null"
          ],
          "properties": {
            "from": {
              "type": "string",
              "format": "date-time"
            },
            "until": {
              "type": "string",
              "format": "date-time",
              "description": "Exclusive end of the fee-free period."
            }
          }
        }
      }
    },
    "planTerms": {
      "type": "object",
      "description": "Terms that hold for every plan."
    },
    "linkParameters": {
      "type": "object",
      "description": "Query parameters the product pages understand."
    },
    "destinations": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/destination"
      }
    },
    "plans": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/plan"
      }
    }
  },
  "$defs": {
    "currency": {
      "type": "string",
      "pattern": "^[A-Z]{3}$"
    },
    "prices": {
      "type": "object",
      "description": "Amount in major units per ISO 4217 currency (HUF has no decimals).",
      "propertyNames": {
        "$ref": "#/$defs/currency"
      },
      "additionalProperties": {
        "type": "number",
        "exclusiveMinimum": 0
      }
    },
    "destination": {
      "type": "object",
      "required": [
        "id",
        "name",
        "type",
        "countries",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Opaque, stable identifier."
        },
        "name": {
          "type": "string"
        },
        "type": {
          "enum": [
            "country",
            "region",
            "global"
          ]
        },
        "countries": {
          "type": "array",
          "minItems": 1,
          "items": {
            "type": "object",
            "required": [
              "iso2",
              "name",
              "networks"
            ],
            "properties": {
              "iso2": {
                "type": "string",
                "pattern": "^[A-Z]{2}$"
              },
              "name": {
                "type": "string"
              },
              "networks": {
                "type": "array",
                "items": {
                  "type": "string"
                }
              }
            }
          }
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "localizedUrls": {
          "type": "object",
          "additionalProperties": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    },
    "plan": {
      "type": "object",
      "required": [
        "id",
        "destinationId",
        "name",
        "countries",
        "dataType",
        "dataGb",
        "dailyDataGb",
        "validityDays",
        "throttling",
        "prices",
        "url"
      ],
      "properties": {
        "id": {
          "type": "string",
          "description": "Stable while the plan exists. A changed allowance or validity gives a new id."
        },
        "destinationId": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "countries": {
          "type": "array",
          "items": {
            "type": "string",
            "pattern": "^[A-Z]{2}$"
          },
          "minItems": 1
        },
        "dataType": {
          "enum": [
            "fixed",
            "daily"
          ],
          "description": "fixed = dataGb for the whole validity; daily = dailyDataGb every day, unused data does not carry over."
        },
        "dataGb": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0
        },
        "dailyDataGb": {
          "type": [
            "number",
            "null"
          ],
          "exclusiveMinimum": 0
        },
        "validityDays": {
          "type": "integer",
          "minimum": 1
        },
        "throttling": {
          "type": [
            "object",
            "null"
          ],
          "description": "null = full speed until the data is used up.",
          "properties": {
            "afterPercentOfDailyData": {
              "type": "number"
            },
            "speedKbps": {
              "type": "number"
            },
            "dailyDataCarriesOver": {
              "type": "boolean"
            }
          }
        },
        "prices": {
          "$ref": "#/$defs/prices"
        },
        "url": {
          "type": "string",
          "format": "uri"
        }
      }
    }
  }
}
