{
    "openapi": "3.1.0",
    "info": {
        "title": "Radio Online AI API",
        "version": "1.2.0",
        "description": "API for finding real radio stations on radio-online.ru and creating noindex personalized selections."
    },
    "servers": [
        {
            "url": "https://radio-online.ru"
        }
    ],
    "paths": {
        "/api/ai/search": {
            "get": {
                "operationId": "searchRadioStations",
                "summary": "Search radio stations",
                "parameters": [
                    {
                        "name": "q",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "lang",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "city",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        }
                    },
                    {
                        "name": "category",
                        "in": "query",
                        "schema": {
                            "type": "integer"
                        }
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Matching radio stations"
                    }
                }
            }
        },
        "/api/ai/stations": {
            "get": {
                "operationId": "listRadioStations",
                "summary": "List radio stations",
                "parameters": [
                    {
                        "name": "ids",
                        "in": "query",
                        "schema": {
                            "type": "string"
                        },
                        "description": "Comma separated station IDs"
                    },
                    {
                        "name": "limit",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 100
                        }
                    },
                    {
                        "name": "offset",
                        "in": "query",
                        "schema": {
                            "type": "integer",
                            "minimum": 0
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Radio stations"
                    }
                }
            }
        },
        "/api/ai/station/{id}": {
            "get": {
                "operationId": "getRadioStation",
                "summary": "Get one radio station by ID",
                "parameters": [
                    {
                        "name": "id",
                        "in": "path",
                        "required": true,
                        "schema": {
                            "type": "integer"
                        }
                    }
                ],
                "responses": {
                    "200": {
                        "description": "Radio station"
                    },
                    "404": {
                        "description": "Not found"
                    }
                }
            }
        },
        "/api/ai/categories": {
            "get": {
                "operationId": "listRadioCategories",
                "summary": "List available site categories",
                "responses": {
                    "200": {
                        "description": "Categories"
                    }
                }
            }
        },
        "/api/ai/mix": {
            "post": {
                "operationId": "createRadioMix",
                "summary": "Create a shareable personalized radio selection",
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "type": "object",
                                "required": [
                                    "station_ids",
                                    "title"
                                ],
                                "properties": {
                                    "station_ids": {
                                        "type": "array",
                                        "items": {
                                            "type": "integer"
                                        },
                                        "minItems": 1,
                                        "maxItems": 50
                                    },
                                    "title": {
                                        "type": "string",
                                        "maxLength": 150
                                    },
                                    "description": {
                                        "type": "string",
                                        "maxLength": 1000
                                    },
                                    "expires_days": {
                                        "type": "integer",
                                        "minimum": 1,
                                        "maximum": 365,
                                        "default": 90
                                    }
                                }
                            }
                        }
                    }
                },
                "responses": {
                    "201": {
                        "description": "Created mix"
                    },
                    "400": {
                        "description": "Invalid request"
                    },
                    "429": {
                        "description": "Rate limit"
                    }
                }
            },
            "get": {
                "operationId": "getMixInstructions",
                "summary": "Get GET-only fallback instructions",
                "responses": {
                    "200": {
                        "description": "Instructions"
                    }
                }
            }
        }
    }
}