{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/gasquebec-ca/json-schema/gasquebec-ca-city-directory-schema.json",
  "title": "CityDirectory",
  "x-generated": "2026-11-09",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/gasquebec-ca-openapi.yml#/components/schemas/CityDirectory",
  "type": "object",
  "properties": {
    "cities": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/CitySummary"
      }
    },
    "unit": {
      "type": "string",
      "enum": [
        "¢/L"
      ]
    },
    "currency": {
      "type": "string",
      "enum": [
        "CAD"
      ]
    },
    "meta": {
      "type": "object",
      "properties": {
        "attribution": {
          "$ref": "#/$defs/Attribution"
        }
      }
    }
  },
  "$defs": {
    "Attribution": {
      "type": "object",
      "description": "Ready-to-use link-back credit. Required wherever the data is displayed publicly (API terms: https://www.gasquebec.ca/en/terms); private use is exempt.",
      "properties": {
        "url": {
          "type": "string",
          "format": "uri",
          "description": "Page to link to: the city page for city data, otherwise https://www.gasquebec.ca/"
        },
        "text": {
          "type": "object",
          "properties": {
            "fr": {
              "type": "string"
            },
            "en": {
              "type": "string"
            }
          }
        },
        "html": {
          "type": "object",
          "description": "`text` with \"Gas Québec\" as a link to `url`, ready to paste",
          "properties": {
            "fr": {
              "type": "string"
            },
            "en": {
              "type": "string"
            }
          }
        }
      },
      "required": [
        "url",
        "text",
        "html"
      ]
    },
    "CitySummary": {
      "type": "object",
      "properties": {
        "slug": {
          "type": "string"
        },
        "name": {
          "type": "string"
        },
        "region": {
          "type": "string",
          "description": "Region slug, e.g. `saguenay-lac-saint-jean`."
        },
        "stationCount": {
          "type": "integer"
        },
        "lat": {
          "type": [
            "number",
            "null"
          ]
        },
        "lng": {
          "type": [
            "number",
            "null"
          ]
        },
        "isBorough": {
          "type": "boolean",
          "description": "A borough of a larger city; its stations also count under the parent."
        },
        "updatedAt": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "Last price change in this city."
        },
        "prices": {
          "type": "object",
          "properties": {
            "regular": {
              "type": "object",
              "properties": {
                "average": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Mean posted price, ¢/L, over the city's stations; null when none posts this fuel."
                }
              }
            },
            "premium": {
              "type": "object",
              "properties": {
                "average": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Mean posted price, ¢/L, over the city's stations; null when none posts this fuel."
                }
              }
            },
            "diesel": {
              "type": "object",
              "properties": {
                "average": {
                  "type": [
                    "number",
                    "null"
                  ],
                  "description": "Mean posted price, ¢/L, over the city's stations; null when none posts this fuel."
                }
              }
            }
          }
        },
        "links": {
          "type": "object",
          "properties": {
            "page": {
              "type": "object",
              "properties": {
                "fr": {
                  "type": "string"
                },
                "en": {
                  "type": "string"
                }
              }
            },
            "prices": {
              "type": "string",
              "description": "The per-city endpoint, with `cheapest` and every station."
            }
          }
        }
      }
    }
  }
}