{
  "components": {
    "schemas": {
      "ErrorResponse": {
        "properties": {
          "error": {
            "properties": {
              "code": {
                "type": "string"
              },
              "message": {
                "type": "string"
              }
            },
            "type": "object"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "apiKeyAuth": {
        "in": "header",
        "name": "X-API-Key",
        "type": "apiKey"
      },
      "bearerAuth": {
        "bearerFormat": "API Key (lpk_live_...)",
        "scheme": "bearer",
        "type": "http"
      }
    }
  },
  "info": {
    "contact": {
      "name": "Lapka Svitla",
      "url": "https://t.me/valerki4_uk"
    },
    "description": "Офіційний REST API та Webhook-система графіків відключень електроенергії (22 області України) і пошуку черги за адресою.",
    "title": "Лапка Світла Developer API",
    "version": "1.0.0"
  },
  "openapi": "3.1.0",
  "paths": {
    "/v1/address/houses": {
      "get": {
        "operationId": "getStreetHouses",
        "parameters": [
          {
            "in": "query",
            "name": "streetId",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Перелік будинків (house, building, label)"
          },
          "400": {
            "description": "Відсутній streetId"
          }
        },
        "summary": "Отримання списку будинків на вулиці",
        "tags": [
          "Address Search"
        ]
      }
    },
    "/v1/address/queues": {
      "get": {
        "operationId": "getAddressQueues",
        "parameters": [
          {
            "in": "query",
            "name": "streetId",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "house",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "building",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "assignments (точний збіг) та nearby (орієнтовна черга по сусідньому будинку)"
          },
          "400": {
            "description": "Відсутні обов'язкові параметри"
          }
        },
        "summary": "Визначення черги та оператора за адресою (з фолбеком на сусідні будинки)",
        "tags": [
          "Address Search"
        ]
      }
    },
    "/v1/address/settlements": {
      "get": {
        "operationId": "searchSettlements",
        "parameters": [
          {
            "example": "Кривий",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "minLength": 2,
              "type": "string"
            }
          },
          {
            "example": "dnipro",
            "in": "query",
            "name": "region",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Список населених пунктів із katottg"
          },
          "400": {
            "description": "Запит коротший за 2 символи"
          }
        },
        "summary": "Пошук населеного пункту (місто/село, КАТОТТГ)",
        "tags": [
          "Address Search"
        ]
      }
    },
    "/v1/address/streets": {
      "get": {
        "operationId": "searchStreets",
        "parameters": [
          {
            "example": "UA12060170010065850",
            "in": "query",
            "name": "katottg",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "example": "Фукса",
            "in": "query",
            "name": "q",
            "required": true,
            "schema": {
              "minLength": 2,
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Список знайдених вулиць із streetId"
          },
          "400": {
            "description": "Некоректні параметри"
          }
        },
        "summary": "Пошук вулиці в населеному пункті за кодом КАТОТТГ",
        "tags": [
          "Address Search"
        ]
      }
    },
    "/v1/me": {
      "get": {
        "operationId": "getAccountMe",
        "responses": {
          "200": {
            "description": "Профіль розробника, ліміти та статистика використання за сьогодні"
          },
          "401": {
            "description": "Невалідний API-ключ"
          },
          "403": {
            "description": "Акаунт очікує схвалення, призупинений або прострочений"
          }
        },
        "summary": "Інформація про акаунт та залишок денної квоти",
        "tags": [
          "Account"
        ]
      }
    },
    "/v1/regions": {
      "get": {
        "operationId": "listRegions",
        "parameters": [
          {
            "description": "ETag попередньої відповіді для 304 Not Modified",
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Масив регіонів, режим (scheduled/emergency), статистика та оператори"
          },
          "304": {
            "description": "Дані не змінилися"
          }
        },
        "summary": "Зведення по всіх 22 регіонах (без масивів черг)",
        "tags": [
          "Schedules"
        ]
      }
    },
    "/v1/regions/{slug}": {
      "get": {
        "operationId": "getRegionBySlug",
        "parameters": [
          {
            "example": "dnipro",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "description": "Ключ або код оператора (опціонально)",
            "in": "query",
            "name": "operator",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Повний розклад по чергах на сьогодні й завтра"
          },
          "304": {
            "description": "Дані не змінилися"
          },
          "404": {
            "description": "Регіон або оператор не знайдено"
          }
        },
        "summary": "Повний графік регіону з усіма операторами та чергами",
        "tags": [
          "Schedules"
        ]
      }
    },
    "/v1/regions/{slug}/queues/{queue}": {
      "get": {
        "operationId": "getQueueSchedule",
        "parameters": [
          {
            "example": "kyiv",
            "in": "path",
            "name": "slug",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "example": "1.1",
            "in": "path",
            "name": "queue",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "in": "query",
            "name": "operator",
            "required": false,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Погодинні слоти, інтервали та liveStatus (isOffNow, currentInterval, nextChangeAt)"
          },
          "404": {
            "description": "Регіон, оператор або чергу не знайдено"
          }
        },
        "summary": "Графік і поточний статус світла для однієї черги",
        "tags": [
          "Schedules"
        ]
      }
    },
    "/v1/schedules/full": {
      "get": {
        "operationId": "getFullSchedules",
        "parameters": [
          {
            "in": "header",
            "name": "If-None-Match",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Повний RegionsSnapshotDTO"
          },
          "304": {
            "description": "Дані не змінилися"
          }
        },
        "summary": "Повний знімок усіх 22 регіонів із усіма чергами (для серверного кешування)",
        "tags": [
          "Schedules"
        ]
      }
    },
    "/v1/webhooks": {
      "get": {
        "operationId": "listWebhooks",
        "responses": {
          "200": {
            "description": "Список вебхуків із фільтрами та статусом останньої доставки"
          }
        },
        "summary": "Перелік налаштованих вебхуків (без розкриття повного секрету)",
        "tags": [
          "Webhooks"
        ]
      }
    }
  },
  "security": [
    {
      "bearerAuth": []
    },
    {
      "apiKeyAuth": []
    }
  ],
  "servers": [
    {
      "description": "Production API",
      "url": "https://api.lapka.help"
    }
  ]
}