{
  "openapi": "3.1.0",
  "info": {
    "title": "Tranquila Corazón Catalog API",
    "version": "2026.04",
    "description": "Catálogo de productos devocionales para agentic checkout 2026 (Perplexity Instant Buy, ChatGPT Instant Checkout, Google Shopping, Meta Catalog).",
    "contact": {
      "name": "Tranquila Corazón",
      "email": "hola@tranquilacorazon.com",
      "url": "https://tranquilacorazon.com"
    },
    "license": {
      "name": "Proprietary",
      "url": "https://tranquilacorazon.com/terminos"
    }
  },
  "servers": [
    {
      "url": "https://www.tranquilacorazon.com",
      "description": "Producción (canónico con www)"
    }
  ],
  "paths": {
    "/feed.json": {
      "get": {
        "operationId": "getProductFeedJson",
        "summary": "Obtener catálogo completo (JSON agentic)",
        "description": "Devuelve todos los productos disponibles con precio, stock, imágenes, atributos y link canónico para instant checkout.",
        "responses": {
          "200": {
            "description": "Feed JSON",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProductFeed"
                }
              }
            }
          }
        }
      }
    },
    "/feed": {
      "get": {
        "operationId": "getProductFeedXml",
        "summary": "Obtener catálogo completo (XML Google Shopping)",
        "responses": {
          "200": {
            "description": "Feed XML RSS 2.0",
            "content": {
              "application/xml": {}
            }
          }
        }
      }
    },
    "/api/feed/products": {
      "get": {
        "operationId": "getProductFeedJsonApi",
        "summary": "Alias /api del feed JSON",
        "responses": {
          "200": {
            "description": "Feed JSON",
            "content": {
              "application/json": {
                "schema": { "$ref": "#/components/schemas/ProductFeed" }
              }
            }
          }
        }
      }
    },
    "/api/feed/products.xml": {
      "get": {
        "operationId": "getProductFeedXmlApi",
        "summary": "Alias /api del feed XML (Google Merchant Center)",
        "responses": {
          "200": {
            "description": "Feed XML RSS 2.0 con namespace g:",
            "content": {
              "application/xml": {}
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ProductFeed": {
        "type": "object",
        "properties": {
          "version": { "type": "string", "example": "2026.04" },
          "schema": { "type": "string", "example": "https://schema.org/Product" },
          "generator": { "type": "string" },
          "feed_url": { "type": "string", "format": "uri" },
          "site_url": { "type": "string", "format": "uri" },
          "contact_email": { "type": "string", "format": "email" },
          "locale": { "type": "string", "example": "es-MX" },
          "currency": { "type": "string", "example": "MXN" },
          "last_modified": { "type": "string", "format": "date-time" },
          "total": { "type": "integer" },
          "items": {
            "type": "array",
            "items": { "$ref": "#/components/schemas/ProductFeedItem" }
          }
        }
      },
      "ProductFeedItem": {
        "type": "object",
        "required": ["id", "title", "link", "image_link", "price", "availability"],
        "properties": {
          "id": { "type": "string" },
          "item_group_id": { "type": "string" },
          "title": { "type": "string" },
          "description": { "type": "string" },
          "link": { "type": "string", "format": "uri" },
          "product_link": { "type": "string", "format": "uri" },
          "image_link": { "type": "string", "format": "uri" },
          "additional_image_link": {
            "type": "array",
            "items": { "type": "string", "format": "uri" }
          },
          "availability": {
            "type": "string",
            "enum": ["in_stock", "out_of_stock", "preorder", "backorder"]
          },
          "quantity_available": { "type": ["integer", "null"] },
          "price": { "type": "string", "example": "499.00 MXN" },
          "sale_price": { "type": ["string", "null"] },
          "price_valid_until": { "type": "string", "format": "date-time" },
          "brand": { "type": "string" },
          "vendor": { "type": "string" },
          "product_type": { "type": "string" },
          "google_product_category": { "type": "string" },
          "condition": {
            "type": "string",
            "enum": ["new", "refurbished", "used"]
          },
          "gtin": { "type": ["string", "null"] },
          "mpn": { "type": "string" },
          "sku": { "type": ["string", "null"] },
          "identifier_exists": { "type": "boolean" },
          "shipping_weight": { "type": ["string", "null"] },
          "shipping": {
            "type": "object",
            "properties": {
              "country": { "type": "string" },
              "service": { "type": "string" },
              "price": { "type": "string" }
            }
          },
          "attributes": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "name": { "type": "string" },
                "value": { "type": "string" }
              }
            }
          },
          "collections": {
            "type": "array",
            "items": { "type": "string" }
          },
          "tags": {
            "type": "array",
            "items": { "type": "string" }
          },
          "content_language": { "type": "string" },
          "target_country": { "type": "string" },
          "updated_at": { "type": ["string", "null"], "format": "date-time" }
        }
      }
    }
  }
}
