{
    "openapi": "3.1.0",
    "info": {
        "title": "Mundo Motores CR Agent Read API",
        "version": "1.0.0",
        "description": "Public read-only API for discovering and accessing published automotive journalism, technical specifications, vehicle reviews, comparisons, and industry news from Mundo Motores CR (Costa Rica).",
        "contact": {
            "name": "Mundo Motores CR Editorial Team",
            "url": "https://mundomotorescr.com/contacto/"
        },
        "license": {
            "name": "Open Editorial Content",
            "url": "https://mundomotorescr.com/developers/"
        }
    },
    "servers": [
        {
            "url": "https://mundomotorescr.com/wp-json/mundomotores/v1",
            "description": "Standard WordPress REST Namespace"
        },
        {
            "url": "https://mundomotorescr.com/api/agent/v1",
            "description": "Direct Agent Route"
        }
    ],
    "externalDocs": {
        "description": "Mundo Motores CR Developer Resources & Integration Guide",
        "url": "https://mundomotorescr.com/developers/"
    },
    "paths": {
        "/site": {
            "get": {
                "summary": "Get site and publisher metadata",
                "description": "Returns primary site identity, market context, language, editorial scope, and links to machine-readable resources.",
                "operationId": "getSiteInfo",
                "responses": {
                    "200": {
                        "description": "Site metadata successfully retrieved",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/SiteInfo"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/articles": {
            "get": {
                "summary": "List published automotive articles",
                "description": "Retrieves a paginated list of published automotive articles, reviews, comparisons, and technical specifications with summary metadata.",
                "operationId": "listArticles",
                "parameters": [
                    {
                        "name": "page",
                        "in": "query",
                        "description": "Page number to retrieve (starts at 1).",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "default": 1
                        }
                    },
                    {
                        "name": "per_page",
                        "in": "query",
                        "description": "Number of articles per page (maximum 50).",
                        "required": false,
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 50,
                            "default": 10
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "description": "Filter articles by category slug (e.g., noticias, articulos, tendencias).",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "search",
                        "in": "query",
                        "description": "Search keyword across published titles and content.",
                        "required": false,
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Paginated list of articles",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ArticleListResponse"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid parameter (e.g. per_page > 50 or negative page)",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/articles/{slug}": {
            "get": {
                "summary": "Get article detail by slug",
                "description": "Retrieves full article metadata and plain text content for a published vehicle review, news piece, or technical specification.",
                "operationId": "getArticleBySlug",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "description": "The URL slug of the published article.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Full article detail",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ArticleDetail"
                                }
                            }
                        }
                    },
                    "404": {
                        "description": "Article not found",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/categories": {
            "get": {
                "summary": "List editorial categories",
                "description": "Retrieves public editorial categories and taxonomies in Mundo Motores CR.",
                "operationId": "listCategories",
                "responses": {
                    "200": {
                        "description": "List of categories",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CategoryListResponse"
                                }
                            }
                        }
                    },
                    "429": {
                        "description": "Rate limit exceeded",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/health": {
            "get": {
                "summary": "Check API service status",
                "description": "Verifies that the Agent Read API service is online and operational.",
                "operationId": "getApiHealth",
                "responses": {
                    "200": {
                        "description": "Service is healthy",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/HealthResponse"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/example": {
            "get": {
                "summary": "Get static sample integration payload",
                "description": "Returns a static sample response useful for testing agent tool calling and schema validation without querying live database records.",
                "operationId": "getExample",
                "responses": {
                    "200": {
                        "description": "Sample static data response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ExampleResponse"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "SiteInfo": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string",
                        "example": "Mundo Motores CR"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri",
                        "example": "https://mundomotorescr.com/"
                    },
                    "description": {
                        "type": "string"
                    },
                    "language": {
                        "type": "string",
                        "example": "es-CR"
                    },
                    "market": {
                        "type": "string",
                        "example": "Costa Rica"
                    },
                    "endpoints": {
                        "type": "object",
                        "properties": {
                            "articles": {
                                "type": "string",
                                "format": "uri"
                            },
                            "categories": {
                                "type": "string",
                                "format": "uri"
                            },
                            "health": {
                                "type": "string",
                                "format": "uri"
                            },
                            "openapi": {
                                "type": "string",
                                "format": "uri"
                            },
                            "docs": {
                                "type": "string",
                                "format": "uri"
                            }
                        }
                    }
                },
                "required": [
                    "name",
                    "url",
                    "language",
                    "market"
                ]
            },
            "ArticleSummary": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "title": {
                        "type": "string"
                    },
                    "excerpt": {
                        "type": "string"
                    },
                    "published": {
                        "type": "string"
                    },
                    "modified": {
                        "type": "string"
                    },
                    "author": {
                        "type": "string"
                    },
                    "category": {
                        "type": "string"
                    },
                    "featured_image": {
                        "type": "string"
                    }
                },
                "required": [
                    "id",
                    "slug",
                    "url",
                    "title",
                    "published"
                ]
            },
            "ArticleListResponse": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/ArticleSummary"
                        }
                    },
                    "pagination": {
                        "$ref": "#/components/schemas/Pagination"
                    }
                },
                "required": [
                    "data",
                    "pagination"
                ]
            },
            "ArticleDetail": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "title": {
                        "type": "string"
                    },
                    "excerpt": {
                        "type": "string"
                    },
                    "content_text": {
                        "type": "string"
                    },
                    "published": {
                        "type": "string"
                    },
                    "modified": {
                        "type": "string"
                    },
                    "author": {
                        "type": "object",
                        "properties": {
                            "name": {
                                "type": "string"
                            }
                        }
                    },
                    "categories": {
                        "type": "array",
                        "items": {
                            "type": "string"
                        }
                    },
                    "featured_image": {
                        "type": "string"
                    },
                    "canonical": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "required": [
                    "id",
                    "slug",
                    "url",
                    "title",
                    "content_text",
                    "published"
                ]
            },
            "Category": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "name": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    }
                },
                "required": [
                    "id",
                    "name",
                    "slug"
                ]
            },
            "CategoryListResponse": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Category"
                        }
                    }
                },
                "required": [
                    "data"
                ]
            },
            "Pagination": {
                "type": "object",
                "properties": {
                    "page": {
                        "type": "integer"
                    },
                    "per_page": {
                        "type": "integer"
                    },
                    "total": {
                        "type": "integer"
                    },
                    "total_pages": {
                        "type": "integer"
                    }
                },
                "required": [
                    "page",
                    "per_page",
                    "total",
                    "total_pages"
                ]
            },
            "ApiError": {
                "type": "object",
                "properties": {
                    "error": {
                        "type": "object",
                        "properties": {
                            "code": {
                                "type": "string",
                                "example": "ARTICLE_NOT_FOUND"
                            },
                            "message": {
                                "type": "string",
                                "example": "The requested article was not found."
                            },
                            "status": {
                                "type": "integer",
                                "example": 404
                            },
                            "hint": {
                                "type": "string",
                                "example": "Check the slug or use the articles endpoint."
                            },
                            "docs_url": {
                                "type": "string",
                                "format": "uri",
                                "example": "https://mundomotorescr.com/developers/"
                            }
                        },
                        "required": [
                            "code",
                            "message",
                            "status"
                        ]
                    }
                },
                "required": [
                    "error"
                ]
            },
            "HealthResponse": {
                "type": "object",
                "properties": {
                    "status": {
                        "type": "string",
                        "example": "ok"
                    },
                    "service": {
                        "type": "string",
                        "example": "Mundo Motores CR Agent Read API"
                    },
                    "version": {
                        "type": "string",
                        "example": "1.0.0"
                    }
                },
                "required": [
                    "status",
                    "service",
                    "version"
                ]
            },
            "ExampleResponse": {
                "type": "object",
                "properties": {
                    "example": {
                        "type": "boolean",
                        "example": true
                    },
                    "description": {
                        "type": "string"
                    },
                    "article": {
                        "type": "object",
                        "properties": {
                            "title": {
                                "type": "string"
                            },
                            "slug": {
                                "type": "string"
                            },
                            "url": {
                                "type": "string"
                            }
                        }
                    }
                },
                "required": [
                    "example",
                    "description"
                ]
            }
        }
    }
}