{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/entityindex-ai/json-schema/entityindex-ai-entity-schema.json",
  "title": "Entity",
  "description": "Common record for any business (full schema at /api/schema/entity.json).",
  "x-generated": "2026-11-07",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/entityindex-ai-openapi.json#/components/schemas/Entity",
  "type": "object",
  "required": [
    "id",
    "entity_type",
    "vertical",
    "country",
    "name",
    "official_url"
  ],
  "properties": {
    "id": {
      "type": "string",
      "description": "{country_code}-{vertical}-{slug}"
    },
    "entity_type": {
      "type": "string",
      "const": "business"
    },
    "vertical": {
      "type": "string"
    },
    "sector": {
      "type": "string",
      "description": "Legacy alias of vertical"
    },
    "subtype": {
      "type": "string"
    },
    "schema_type": {
      "type": "string",
      "description": "schema.org type"
    },
    "country": {
      "type": "string",
      "description": "ISO 3166-1 alpha-2"
    },
    "country_slug": {
      "type": "string"
    },
    "name": {
      "type": "string"
    },
    "location": {
      "$ref": "#/$defs/Location"
    },
    "official_url": {
      "type": "string",
      "format": "uri"
    },
    "action_url": {
      "type": "string",
      "format": "uri",
      "description": "Official website or booking engine with src=entityindex"
    },
    "action_type": {
      "type": "string"
    },
    "booking_engine_detected": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "contact": {
      "type": "object",
      "properties": {
        "email": {
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "phone": {
          "type": "array",
          "items": {
            "type": "string"
          }
        }
      }
    },
    "attributes": {
      "type": "object",
      "description": "Vertical-specific attributes",
      "additionalProperties": true
    },
    "verified": {
      "type": "object",
      "description": "Verified facts keyed by field name (e.g. spa, pool, parking, ski_in_out).",
      "additionalProperties": {
        "$ref": "#/$defs/VerifiedFact"
      }
    },
    "verification": {
      "type": "object",
      "properties": {
        "status": {
          "type": "string",
          "enum": [
            "auto",
            "manual",
            "owner"
          ]
        },
        "method": {
          "type": "string"
        },
        "checked": {
          "type": "string",
          "format": "date"
        },
        "note": {
          "type": "string"
        }
      }
    },
    "url": {
      "type": "string",
      "format": "uri"
    },
    "api": {
      "type": "string"
    },
    "pages": {
      "type": "object",
      "description": "Record page per language",
      "additionalProperties": {
        "type": "string",
        "format": "uri"
      }
    },
    "i18n": {
      "type": "object",
      "description": "Translated labels and notes per language",
      "additionalProperties": true
    },
    "license": {
      "$ref": "#/$defs/License"
    }
  },
  "$defs": {
    "License": {
      "type": "object",
      "properties": {
        "name": {
          "type": "string"
        },
        "url": {
          "type": "string",
          "format": "uri"
        },
        "attribution": {
          "type": "string"
        }
      }
    },
    "Location": {
      "type": "object",
      "properties": {
        "locality": {
          "type": "string"
        },
        "region": {
          "type": "string"
        },
        "country": {
          "type": "string",
          "description": "ISO 3166-1 alpha-2"
        }
      }
    },
    "VerifiedFact": {
      "type": "object",
      "required": [
        "value",
        "source",
        "checked"
      ],
      "properties": {
        "value": {
          "description": "Fact value (boolean, number or string)"
        },
        "source": {
          "type": "string",
          "format": "uri",
          "description": "Official page where the fact was read"
        },
        "evidence": {
          "type": "string",
          "description": "Literal excerpt from the source"
        },
        "checked": {
          "type": "string",
          "format": "date"
        },
        "status": {
          "type": "string"
        }
      }
    }
  }
}