{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://pahvender.com/contracts/catalog-v1.schema.json",
  "title": "PahVender public catalog payload v1",
  "description": "Contrato de datos esperado por el adaptador del sitio. No declara que PV-30 esté desplegado.",
  "type": "object",
  "additionalProperties": false,
  "required": ["version", "generatedAt", "items"],
  "properties": {
    "version": { "const": "1.0" },
    "generatedAt": { "type": "string", "format": "date-time" },
    "items": {
      "type": "array",
      "maxItems": 100,
      "items": { "$ref": "#/$defs/item" }
    }
  },
  "$defs": {
    "item": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "publicId",
        "slug",
        "producerName",
        "name",
        "summary",
        "kind",
        "status",
        "availability",
        "publicUrl"
      ],
      "properties": {
        "publicId": { "type": "string", "minLength": 3, "maxLength": 80 },
        "slug": { "type": "string", "pattern": "^[a-z0-9]+(?:-[a-z0-9]+)*$", "minLength": 2, "maxLength": 80 },
        "producerName": { "type": "string", "minLength": 2, "maxLength": 120 },
        "name": { "type": "string", "minLength": 2, "maxLength": 140 },
        "summary": { "type": "string", "minLength": 10, "maxLength": 500 },
        "kind": { "enum": ["digital_product", "service"] },
        "status": { "const": "published" },
        "availability": { "enum": ["beta", "available", "paused"] },
        "publicUrl": { "type": "string", "format": "uri", "pattern": "^https://pahvender\\.com/", "maxLength": 500 },
        "displayPrice": {
          "type": "object",
          "additionalProperties": false,
          "required": ["amount", "currency"],
          "properties": {
            "amount": { "type": "number", "minimum": 0 },
            "currency": { "type": "string", "pattern": "^[A-Z]{3}$" }
          }
        }
      }
    }
  }
}
