{
    "openapi": "3.1.0",
    "info": {
        "title": "ClimaSaudi Agent API",
        "version": "1.0.3",
        "description": "Public read and checkout-intent API for AI agents discovering ClimaSaudi air purifiers, humidifiers, filters, Saudi delivery, and card checkout options."
    },
    "servers": [
        {
            "url": "https://climasaudi.com/wp-json/climatepro-agent-ready/v1"
        }
    ],
    "paths": {
        "/status": {
            "get": {
                "operationId": "getAgentApiStatus",
                "summary": "Get public agent API metadata",
                "responses": {
                    "200": {
                        "description": "Status response",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/products": {
            "get": {
                "operationId": "searchProducts",
                "summary": "Search ClimaSaudi products",
                "parameters": [
                    {
                        "name": "query",
                        "in": "query",
                        "required": false,
                        "description": "Search text",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "description": "Product category slug",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "brand",
                        "in": "query",
                        "required": false,
                        "description": "Brand slug",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Maximum products to return",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Response language: en or ar",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Product list",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/products/{slug}": {
            "get": {
                "operationId": "getProduct",
                "summary": "Get detailed product data",
                "parameters": [
                    {
                        "name": "slug",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "required": false,
                        "description": "Response language: en or ar",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Product detail",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/cart-intent": {
            "post": {
                "operationId": "createCartIntent",
                "summary": "Create a browser checkout intent",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "properties": {
                                    "items": {
                                        "type": "array",
                                        "items": {
                                            "type": "object",
                                            "properties": {
                                                "product_id": {
                                                    "type": "integer"
                                                },
                                                "quantity": {
                                                    "type": "integer",
                                                    "minimum": 1
                                                }
                                            },
                                            "required": [
                                                "product_id"
                                            ]
                                        }
                                    }
                                },
                                "required": [
                                    "items"
                                ]
                            }
                        }
                    }
                },
                "responses": {
                    "200": {
                        "description": "Checkout intent",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "type": "object"
                                }
                            }
                        }
                    }
                },
                "x-payment-info": {
                    "intent": "session",
                    "method": [
                        "card_payment"
                    ],
                    "currency": "SAR",
                    "amount": "dynamic",
                    "checkout": "https://climasaudi.com/checkout/",
                    "payment_method_status": {
                        "card_payment": "available"
                    }
                }
            }
        }
    },
    "components": {
        "securitySchemes": {
            "publicRead": {
                "type": "http",
                "scheme": "bearer",
                "description": "Public product discovery does not require authentication. Customer checkout requires customer-controlled browser payment."
            }
        }
    }
}
