{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://www.ironscout.ai/ids/schemas/retailer_directory_v1.schema.json",
  "title": "retailer_directory_v1",
  "description": "IDS v1 response shape for GET /api/ids/retailers. Lists currently eligible/visible retailers per query-time visibility (ADR-005, IDS §4.2/§5.4). Ineligible retailers are omitted entirely (fail-closed). See https://www.ironscout.ai/.well-known/ids.md.",
  "type": "object",
  "additionalProperties": false,
  "required": ["schemaVersion", "computedAt", "retailers", "meta"],
  "properties": {
    "schemaVersion": { "type": "string", "const": "retailer_directory_v1" },
    "requestId": { "type": ["string", "null"] },
    "computedAt": { "type": "string", "format": "date-time" },
    "retailers": {
      "type": "array",
      "items": { "$ref": "#/$defs/retailer" }
    },
    "meta": {
      "type": "object",
      "additionalProperties": false,
      "required": ["totalRetailers"],
      "properties": {
        "totalRetailers": { "type": "integer", "minimum": 0 }
      }
    }
  },
  "$defs": {
    "retailer": {
      "type": "object",
      "additionalProperties": false,
      "required": ["retailerId", "name", "domain", "visibilityStatus"],
      "properties": {
        "retailerId": { "type": "string" },
        "name": { "type": "string" },
        "domain": { "type": ["string", "null"], "description": "Storefront domain/website." },
        "visibilityStatus": {
          "type": "string",
          "enum": ["eligible", "ineligible", "unknown"],
          "description": "Only 'eligible' retailers are listed in v1; the field is present for forward-compatibility."
        },
        "notes": { "type": ["string", "null"], "description": "Optional disclosure, e.g. 'inventory currently not routed'." }
      }
    }
  }
}
