{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://izifete.fr/.well-known/a2a/event-provider-search-output.schema.json",
  "title": "Izifete event_provider_search output",
  "description": "Résultat public en lecture seule du skill A2A Izifete. Il ne confirme ni disponibilité ni réservation.",
  "type": "object",
  "additionalProperties": false,
  "required": ["source", "version", "status", "city", "groups", "card_ids", "notice"],
  "properties": {
    "source": { "const": "izifete" },
    "version": { "const": "1" },
    "status": {
      "type": "string",
      "enum": ["complete", "partial", "empty", "clarification_required", "unavailable"]
    },
    "city": { "type": "string", "maxLength": 80 },
    "groups": {
      "type": "array",
      "maxItems": 5,
      "items": { "$ref": "#/$defs/group" }
    },
    "card_ids": {
      "type": "array",
      "maxItems": 10,
      "uniqueItems": true,
      "items": { "$ref": "#/$defs/providerId" }
    },
    "notice": { "type": "string", "minLength": 1 }
  },
  "$defs": {
    "service": {
      "type": "string",
      "enum": [
        "traiteur",
        "streetfood",
        "dj",
        "photographe",
        "videaste",
        "photobooth",
        "decorateur",
        "animation",
        "patissier",
        "fleuriste",
        "location",
        "chef",
        "maquilleur",
        "coiffeur",
        "lieu",
        "esthetique"
      ]
    },
    "providerId": {
      "type": "string",
      "pattern": "^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$"
    },
    "provider": {
      "type": "object",
      "additionalProperties": false,
      "required": ["id", "business_name", "city", "coverage", "url"],
      "properties": {
        "id": { "$ref": "#/$defs/providerId" },
        "business_name": { "type": "string", "minLength": 1, "maxLength": 120 },
        "city": { "type": "string", "maxLength": 80 },
        "coverage": {
          "type": ["string", "null"],
          "enum": ["declared_zone", "nationwide", null]
        },
        "url": {
          "type": "string",
          "pattern": "^https://izifete\\.fr/prestataire/[0-9a-fA-F-]+(?:\\?.*)?$",
          "maxLength": 2048
        }
      }
    },
    "attribution": {
      "type": "object",
      "additionalProperties": false,
      "required": ["title", "url"],
      "properties": {
        "title": { "type": "string", "minLength": 1, "maxLength": 100 },
        "url": { "type": "string", "pattern": "^https://", "maxLength": 2048 }
      }
    },
    "externalSource": {
      "type": "object",
      "additionalProperties": false,
      "required": ["source", "external", "verified_by_izifete", "place_id", "label", "google_maps_url", "izifete_url", "attribution"],
      "properties": {
        "source": { "const": "google_maps" },
        "external": { "const": true },
        "verified_by_izifete": { "const": false },
        "place_id": { "type": "string", "minLength": 1, "maxLength": 255 },
        "label": { "type": "string", "minLength": 1, "maxLength": 200 },
        "google_maps_url": { "type": "string", "pattern": "^https://", "maxLength": 2048 },
        "izifete_url": { "type": "string", "pattern": "^https://izifete\\.fr/", "maxLength": 2048 },
        "attribution": { "$ref": "#/$defs/attribution" }
      }
    },
    "external": {
      "type": "object",
      "additionalProperties": false,
      "required": ["state", "sources"],
      "properties": {
        "state": {
          "type": "string",
          "enum": ["disabled", "not_needed", "results", "empty", "unavailable", "quota_exceeded"]
        },
        "sources": {
          "type": "array",
          "maxItems": 5,
          "items": { "$ref": "#/$defs/externalSource" }
        }
      }
    },
    "group": {
      "type": "object",
      "additionalProperties": false,
      "required": ["service", "status", "providers", "external"],
      "properties": {
        "service": { "$ref": "#/$defs/service" },
        "status": {
          "type": "string",
          "enum": ["outside_coverage", "out_of_scope_trade", "ok", "nearby", "distant_only", "empty", "unavailable"]
        },
        "providers": {
          "type": "array",
          "maxItems": 5,
          "items": { "$ref": "#/$defs/provider" }
        },
        "external": { "$ref": "#/$defs/external" }
      }
    }
  }
}
