{
    "openapi": "3.1.0",
    "info": {
        "title": "Actually Useful Deals Public API",
        "version": "1.1.0",
        "description": "Read-only public deal discovery endpoints for current Actually Useful Deals listings."
    },
    "servers": [
        {
            "url": "https://www.actuallyusefuldeals.com/wp-json/aud/v1"
        }
    ],
    "security": [],
    "paths": {
        "/deals": {
            "get": {
                "operationId": "listDeals",
                "summary": "List public active deals",
                "description": "Returns current published deals with shopper-facing price context, buyer fit, and availability details.",
                "parameters": [
                    {
                        "name": "limit",
                        "in": "query",
                        "required": false,
                        "description": "Maximum number of deals to return, 1-100.",
                        "schema": {
                            "type": "integer",
                            "default": 50
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "required": false,
                        "description": "Deal category slug, such as car-gear or power-charging.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "merchant",
                        "in": "query",
                        "required": false,
                        "description": "Merchant name substring, case-insensitive.",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "price_max",
                        "in": "query",
                        "required": false,
                        "description": "Maximum displayed deal price in USD.",
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "discount_min",
                        "in": "query",
                        "required": false,
                        "description": "Minimum percent discount when discount metadata includes a percentage.",
                        "schema": {
                            "type": "number"
                        }
                    },
                    {
                        "name": "updated_after",
                        "in": "query",
                        "required": false,
                        "description": "ISO-8601 timestamp or YYYY-MM-DD date. Returns deals modified after this value.",
                        "schema": {
                            "type": "string"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Public active deals.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/DealList"
                                }
                            }
                        }
                    },
                    "400": {
                        "description": "Invalid request parameter.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Unexpected server error.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/categories": {
            "get": {
                "operationId": "listDealCategories",
                "summary": "List deal categories",
                "description": "Returns public deal category names, slugs, URLs, and current active deal counts.",
                "responses": {
                    "200": {
                        "description": "Public deal categories.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/CategoryList"
                                }
                            }
                        }
                    },
                    "500": {
                        "description": "Unexpected server error.",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/ApiError"
                                }
                            }
                        }
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "ApiError": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                    "code",
                    "message",
                    "data"
                ],
                "properties": {
                    "code": {
                        "type": "string",
                        "example": "aud_invalid_updated_after"
                    },
                    "message": {
                        "type": "string",
                        "example": "updated_after must be an ISO-8601 timestamp or YYYY-MM-DD date."
                    },
                    "data": {
                        "type": "object",
                        "required": [
                            "status"
                        ],
                        "properties": {
                            "status": {
                                "type": "integer",
                                "minimum": 400,
                                "maximum": 599
                            }
                        }
                    }
                }
            },
            "DealList": {
                "type": "object",
                "properties": {
                    "generated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "filters": {
                        "type": "object"
                    },
                    "deals": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Deal"
                        }
                    }
                }
            },
            "Deal": {
                "type": "object",
                "properties": {
                    "id": {
                        "type": "integer"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "title": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "published_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "updated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "category": {
                        "$ref": "#/components/schemas/Category"
                    },
                    "price": {
                        "type": "string"
                    },
                    "price_details": {
                        "$ref": "#/components/schemas/MoneyDisplay"
                    },
                    "typical_price": {
                        "type": "string"
                    },
                    "typical_price_details": {
                        "$ref": "#/components/schemas/MoneyDisplay"
                    },
                    "discount": {
                        "type": "string"
                    },
                    "discount_details": {
                        "type": "object"
                    },
                    "merchant": {
                        "type": "string"
                    },
                    "expiration": {
                        "type": "string"
                    },
                    "useful_for": {
                        "type": "string"
                    },
                    "skip_if": {
                        "type": "string"
                    },
                    "deal_status": {
                        "type": "object"
                    },
                    "savings": {
                        "$ref": "#/components/schemas/Savings"
                    }
                }
            },
            "CategoryList": {
                "type": "object",
                "properties": {
                    "generated_at": {
                        "type": "string",
                        "format": "date-time"
                    },
                    "count": {
                        "type": "integer"
                    },
                    "categories": {
                        "type": "array",
                        "items": {
                            "$ref": "#/components/schemas/Category"
                        }
                    }
                }
            },
            "Category": {
                "type": "object",
                "properties": {
                    "name": {
                        "type": "string"
                    },
                    "slug": {
                        "type": "string"
                    },
                    "url": {
                        "type": "string",
                        "format": "uri"
                    },
                    "active_deal_count": {
                        "type": "integer"
                    }
                }
            },
            "MoneyDisplay": {
                "type": "object",
                "properties": {
                    "amount": {
                        "type": "number"
                    },
                    "currency": {
                        "type": "string",
                        "example": "USD"
                    },
                    "display": {
                        "type": "string"
                    }
                }
            },
            "Savings": {
                "type": "object",
                "properties": {
                    "type": {
                        "type": "string"
                    },
                    "type_label": {
                        "type": "string"
                    },
                    "advice": {
                        "type": "string"
                    },
                    "advice_label": {
                        "type": "string"
                    },
                    "explanation": {
                        "type": "string"
                    },
                    "checked_on": {
                        "type": "string",
                        "format": "date"
                    },
                    "conditions": {
                        "type": "string"
                    }
                }
            }
        }
    }
}