{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://mount-barker-sa-local.vercel.app/data/v1/schema.json",
  "title": "Mount Barker Local public business record v1.1.0",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "id",
    "business_group_id",
    "name",
    "category",
    "schema_type",
    "website",
    "location_type",
    "checked_at",
    "canonical_url",
    "verification",
    "valid_until",
    "phone",
    "note",
    "relationship",
    "offerings",
    "service_area",
    "address",
    "sources",
    "field_sources"
  ],
  "properties": {
    "id": {
      "type": "string",
      "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$"
    },
    "business_group_id": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "category": {
      "type": "string"
    },
    "schema_type": {
      "type": "string"
    },
    "website": {
      "type": "string"
    },
    "location_type": {
      "enum": [
        "public_business_premises",
        "locality_only",
        "service_area_business",
        "service_area_only",
        "nearby_premises",
        "consulting_location"
      ]
    },
    "checked_at": {
      "type": "string",
      "format": "date"
    },
    "canonical_url": {
      "type": "string"
    },
    "verification": {
      "const": "public_website_independently_reviewed"
    },
    "valid_until": {
      "type": "string",
      "format": "date"
    },
    "phone": {
      "type": [
        "string",
        "null"
      ]
    },
    "note": {
      "type": [
        "string",
        "null"
      ]
    },
    "relationship": {
      "enum": [
        null,
        "directory_maintainer"
      ]
    },
    "offerings": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "service_area": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "address": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "street",
        "locality",
        "region",
        "postcode",
        "country"
      ],
      "properties": {
        "street": {
          "type": [
            "string",
            "null"
          ]
        },
        "locality": {
          "type": [
            "string",
            "null"
          ]
        },
        "region": {
          "const": "SA"
        },
        "postcode": {
          "type": [
            "string",
            "null"
          ]
        },
        "country": {
          "const": "AU"
        }
      }
    },
    "sources": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": [
          "url",
          "checked_at",
          "kind"
        ],
        "properties": {
          "url": {
            "type": "string",
            "format": "uri"
          },
          "checked_at": {
            "type": "string",
            "format": "date"
          },
          "kind": {
            "enum": [
              "business_website",
              "official_government",
              "official_manufacturer"
            ]
          }
        }
      }
    },
    "field_sources": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "name",
        "address",
        "phone",
        "website",
        "offerings",
        "service_area",
        "note"
      ],
      "properties": {
        "name": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "address": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "phone": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "website": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "offerings": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "service_area": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        },
        "note": {
          "type": "array",
          "items": {
            "type": "string",
            "format": "uri"
          }
        }
      }
    }
  }
}
