{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/akahu/main/json-schema/akahu-genie-outlet-schema.json",
  "title": "GenieOutlet",
  "description": "An individual outlet (i.e. specific location). An outlet will always be returned in combination with its related \"parent\" merchant.",
  "x-generated": "2026-10-27",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/akahu-genie-transaction-enrichment-api-openapi.yml#/components/schemas/GenieOutlet",
  "type": "object",
  "required": [
    "_id",
    "name"
  ],
  "properties": {
    "_id": {
      "type": "string",
      "description": "The unique outlet identifier."
    },
    "name": {
      "type": "string",
      "description": "The outlet name. This is usually more specific than the merchant name. For example, the merchant name may be \"Pak'nSAVE\", while the outlet name is \"Pak'nSAVE Sylvia Park\"."
    },
    "logo": {
      "type": "string",
      "description": "A URL referencing the outlet's logo. This field will only be included if the logo for this outlet differs from the merchant's logo."
    },
    "website": {
      "type": "string",
      "description": "The URL for the outlet's website. This field will only be included if the website for this outlet differs from the merchant's website."
    },
    "phone": {
      "type": "string",
      "description": "The outlet's phone number. This field will only be included if the phone number for this outlet differs from the merchant's phone number."
    },
    "nzbn": {
      "type": "string",
      "description": "The outlet's NZBN (New Zealand Business Number). This field will only be included if the NZBN for this outlet differs from the merchant's NZBN."
    },
    "location": {
      "description": "The outlet's location.",
      "allOf": [
        {
          "$ref": "#/$defs/GenieLocation"
        }
      ]
    },
    "tags": {
      "type": "array",
      "description": "Tags that apply to the outlet. For example, to indicate that the outlet provides a subscription service. Tags are inherited (and potentially extended) from the outlet's \"parent\" merchant.",
      "items": {
        "$ref": "#/$defs/GenieTag"
      }
    }
  },
  "$defs": {
    "GenieAddress": {
      "type": "object",
      "required": [
        "street",
        "city",
        "region",
        "country",
        "postal_code"
      ],
      "properties": {
        "street": {
          "type": "string"
        },
        "suburb": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "postal_code": {
          "type": "string"
        }
      }
    },
    "GenieCoordinates": {
      "type": "object",
      "description": "Latitude/longitude location coordinates.",
      "required": [
        "lat",
        "lon"
      ],
      "properties": {
        "lat": {
          "type": "number"
        },
        "lon": {
          "type": "number"
        }
      }
    },
    "GenieLocation": {
      "type": "object",
      "description": "A physical location.",
      "required": [
        "accuracy",
        "formatted",
        "coordinates"
      ],
      "properties": {
        "accuracy": {
          "type": "string",
          "enum": [
            "country",
            "region",
            "locality",
            "sublocality",
            "establishment"
          ]
        },
        "formatted": {
          "type": "string"
        },
        "coordinates": {
          "$ref": "#/$defs/GenieCoordinates"
        },
        "address": {
          "description": "The address fields in a structured format. This is available on almost all establishment-level locations, however it may occasionally be missing,",
          "allOf": [
            {
              "$ref": "#/$defs/GenieAddress"
            }
          ]
        }
      }
    },
    "GenieTag": {
      "type": "string",
      "description": "A tag applied to an outlet or merchant, indicating a specific attribute that applies to that entity.",
      "enum": [
        "subscription",
        "closed"
      ]
    }
  }
}