{
  "openapi": "3.1.0",
  "info": {
    "title": "Калькуляторы материалов «Благоустрой»",
    "version": "1.0.0",
    "description": "Расчёт обоев (по полосам с раппортом), плитки и напольных покрытий (запас по способу укладки) и краски (расход по меньшему краю). Формулы те же, что в мобильном приложении «Благоустрой». Без ключа, только GET."
  },
  "servers": [
    {
      "url": "https://erablaga.ru"
    }
  ],
  "paths": {
    "/calculators/api/wallpaper": {
      "get": {
        "operationId": "calculate_wallpaper",
        "summary": "Калькулятор обоев по полосам с учётом раппорта",
        "description": "Обои считают по полосам, а не по площади. Периметр делят на ширину рулона и получают число полос. Длину полосы берут как высоту стены плюс 10 см на подрезку и округляют вверх до целого раппорта. Из рулона выходит целое число полос, остаток идёт в обрезки. Комната 4 × 3 м с потолком 2,7 м и рулоном 1,06 × 10,05 м: 14 полос, 5 рулонов. При стыковке со смещением 64/32 полоса вырастает до 3,52 м, из рулона выходит две полосы, и рулонов нужно 7.\n\nПример: https://erablaga.ru/calculators/api/wallpaper?length=4&width=3&height=2.7&roll=1.06x10.05&rapport=64&shift=32&doors=1 — 7 рулонов с разбивкой по полосам.",
        "parameters": [
          {
            "name": "length",
            "in": "query",
            "required": false,
            "description": "Длина комнаты, м. Синонимы имени: room_length, length_m, l",
            "schema": {
              "type": "number"
            },
            "example": "4"
          },
          {
            "name": "width",
            "in": "query",
            "required": false,
            "description": "Ширина комнаты, м. Синонимы имени: room_width, width_m, w",
            "schema": {
              "type": "number"
            },
            "example": "3"
          },
          {
            "name": "height",
            "in": "query",
            "required": false,
            "description": "Высота стен (потолка), м; если не задана, берётся 2,7 м, и это сказано в assumptions. Синонимы имени: room_height, ceiling_height, wall_height, height_m, h",
            "schema": {
              "type": "number"
            },
            "example": "2.7"
          },
          {
            "name": "area",
            "in": "query",
            "required": false,
            "description": "Площадь пола, м², вместо длины и ширины. Для стен тогда нужен perimeter. Синонимы имени: floor_area, room_area, area_m2",
            "schema": {
              "type": "number"
            },
            "example": "18"
          },
          {
            "name": "perimeter",
            "in": "query",
            "required": false,
            "description": "Периметр стен, м. Синонимы имени: perimeter_m",
            "schema": {
              "type": "number"
            },
            "example": "17"
          },
          {
            "name": "doors",
            "in": "query",
            "required": false,
            "description": "Число дверей 0,9 × 2,1 м. Синонимы имени: door",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "windows",
            "in": "query",
            "required": false,
            "description": "Число окон 1,4 × 1,5 м. Синонимы имени: window",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "openings",
            "in": "query",
            "required": false,
            "description": "Проёмы своих размеров через точку с запятой: ширина x высота [x количество], м. Например 0.8x2x2;2.4x2.1",
            "schema": {
              "type": "string"
            },
            "example": "0.8x2x2;2.4x2.1"
          },
          {
            "name": "roll",
            "in": "query",
            "required": false,
            "description": "Размер рулона: ширина x длина, м (порядок не важен). Без него ответ в м² стен, а не в рулонах. Можно и двумя параметрами roll_width, roll_length. Синонимы имени: roll_size",
            "schema": {
              "type": "string"
            },
            "example": "1.06x10.05"
          },
          {
            "name": "rapport",
            "in": "query",
            "required": false,
            "description": "Раппорт рисунка, см, как на этикетке: 64 или 64/32 (второе число — смещение); 0 — без подгонки. Синонимы имени: repeat, pattern_repeat",
            "schema": {
              "type": "string"
            },
            "example": "64"
          },
          {
            "name": "shift",
            "in": "query",
            "required": false,
            "description": "Смещение рисунка, см (стыковка со сдвигом), если не передано в rapport. Синонимы имени: offset, drop",
            "schema": {
              "type": "number"
            },
            "example": "32"
          }
        ],
        "responses": {
          "200": {
            "description": "Расчёт или причина, по которой посчитать нельзя (ok: false, message говорит, каких параметров не хватает).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "calculator": {
                      "type": "string",
                      "enum": [
                        "wallpaper",
                        "tile",
                        "floor",
                        "paint"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Понятые параметры запроса под основными именами"
                    },
                    "summary": {
                      "type": "string",
                      "description": "Ответ одной строкой: «7 рулонов»"
                    },
                    "quantity": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Сколько купить; null, если известна только площадь"
                    },
                    "unit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "exact",
                        "area"
                      ],
                      "description": "exact — рулоны, упаковки, банки; area — только площадь"
                    },
                    "breakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "total": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "label",
                          "value"
                        ]
                      },
                      "description": "Как посчитано"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "Числа расчёта: strips, rolls, packs, litres, cans, площади в м²"
                    },
                    "input_summary": {
                      "type": "string",
                      "description": "С какими данными посчитано"
                    },
                    "assumptions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Что не задано и взято по умолчанию (высота 2,7 м, два слоя)"
                    },
                    "ignored_params": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Параметры запроса, которых калькулятор не знает"
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Параметр → почему не прочитался; при ошибках расчёта нет"
                    },
                    "surface": {
                      "type": "string",
                      "enum": [
                        "floor",
                        "walls",
                        "ceiling"
                      ],
                      "description": "Какая поверхность посчитана"
                    },
                    "surface_area_m2": {
                      "type": "number",
                      "description": "Площадь поверхности до запаса, м²"
                    },
                    "hint": {
                      "type": "string",
                      "description": "При mode: area — какого параметра не хватает до точного числа"
                    },
                    "ignored_hint": {
                      "type": "string",
                      "description": "Где взять список параметров"
                    },
                    "message": {
                      "type": "string",
                      "description": "Что сделать, если ok: false"
                    },
                    "blocker": {
                      "type": "string",
                      "enum": [
                        "missingRoom",
                        "missingPerimeter",
                        "missingInputs",
                        "invalidInput"
                      ],
                      "description": "Почему расчёта нет (при ok: false)"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "Параметры калькулятора (при ok: false)"
                    },
                    "example_url": {
                      "type": "string",
                      "description": "Рабочий пример запроса (при ok: false)"
                    },
                    "page_url": {
                      "type": "string",
                      "description": "Тот же расчёт на странице для человека: дайте его пользователю, чтобы проверить и поменять параметры"
                    },
                    "method_url": {
                      "type": "string",
                      "description": "Как устроен расчёт: формулы и допущения"
                    },
                    "app_url": {
                      "type": "string",
                      "description": "Установка приложения «Благоустрой» с этим калькулятором"
                    },
                    "source": {
                      "type": "string",
                      "description": "Источник расчёта для ссылки в ответе"
                    }
                  },
                  "required": [
                    "ok",
                    "calculator",
                    "title",
                    "input",
                    "page_url",
                    "source"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Параметр не удалось прочитать; errors называет какой и почему."
          }
        }
      }
    },
    "/calculators/api/tile": {
      "get": {
        "operationId": "calculate_tile",
        "summary": "Калькулятор плитки для пола и стен",
        "description": "Плитку считают так: площадь поверхности умножают на запас на подрезку и делят на площадь упаковки, округляя вверх до целой упаковки. Запас для плитки 10 % при прямой укладке и 15 % по диагонали или ёлочкой. Для пола ванной 2,4 × 1,7 м и упаковки 1,44 м² нужно 4 упаковки.\n\nПример: https://erablaga.ru/calculators/api/tile?length=2.4&width=1.7&height=2.5&surface=walls&doors=1&pack_area=1.5 — 14 упаковок на стены ванной за вычетом двери.",
        "parameters": [
          {
            "name": "length",
            "in": "query",
            "required": false,
            "description": "Длина комнаты, м. Синонимы имени: room_length, length_m, l",
            "schema": {
              "type": "number"
            },
            "example": "4"
          },
          {
            "name": "width",
            "in": "query",
            "required": false,
            "description": "Ширина комнаты, м. Синонимы имени: room_width, width_m, w",
            "schema": {
              "type": "number"
            },
            "example": "3"
          },
          {
            "name": "height",
            "in": "query",
            "required": false,
            "description": "Высота стен (потолка), м; если не задана, берётся 2,7 м, и это сказано в assumptions. Синонимы имени: room_height, ceiling_height, wall_height, height_m, h",
            "schema": {
              "type": "number"
            },
            "example": "2.7"
          },
          {
            "name": "area",
            "in": "query",
            "required": false,
            "description": "Площадь пола, м², вместо длины и ширины. Для стен тогда нужен perimeter. Синонимы имени: floor_area, room_area, area_m2",
            "schema": {
              "type": "number"
            },
            "example": "18"
          },
          {
            "name": "perimeter",
            "in": "query",
            "required": false,
            "description": "Периметр стен, м. Синонимы имени: perimeter_m",
            "schema": {
              "type": "number"
            },
            "example": "17"
          },
          {
            "name": "doors",
            "in": "query",
            "required": false,
            "description": "Число дверей 0,9 × 2,1 м. Синонимы имени: door",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "windows",
            "in": "query",
            "required": false,
            "description": "Число окон 1,4 × 1,5 м. Синонимы имени: window",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "openings",
            "in": "query",
            "required": false,
            "description": "Проёмы своих размеров через точку с запятой: ширина x высота [x количество], м. Например 0.8x2x2;2.4x2.1",
            "schema": {
              "type": "string"
            },
            "example": "0.8x2x2;2.4x2.1"
          },
          {
            "name": "surface",
            "in": "query",
            "required": false,
            "description": "Что облицовываем (по умолчанию floor)",
            "schema": {
              "type": "string",
              "enum": [
                "floor",
                "walls"
              ]
            },
            "example": "walls"
          },
          {
            "name": "pattern",
            "in": "query",
            "required": false,
            "description": "Укладка: прямая (запас 10 %), диагональ и ёлочка (15 %); по умолчанию straight. Синонимы имени: layout",
            "schema": {
              "type": "string",
              "enum": [
                "straight",
                "diagonal",
                "herringbone"
              ]
            },
            "example": "straight"
          },
          {
            "name": "waste",
            "in": "query",
            "required": false,
            "description": "Свой запас на подрезку, % (вместо запаса по укладке). Синонимы имени: waste_percent, reserve",
            "schema": {
              "type": "number"
            },
            "example": "12"
          },
          {
            "name": "pack_area",
            "in": "query",
            "required": false,
            "description": "Площадь в упаковке, м². Без неё ответ в м² с запасом. Синонимы имени: pack, pack_m2, box_area",
            "schema": {
              "type": "number"
            },
            "example": "1.44"
          }
        ],
        "responses": {
          "200": {
            "description": "Расчёт или причина, по которой посчитать нельзя (ok: false, message говорит, каких параметров не хватает).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "calculator": {
                      "type": "string",
                      "enum": [
                        "wallpaper",
                        "tile",
                        "floor",
                        "paint"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Понятые параметры запроса под основными именами"
                    },
                    "summary": {
                      "type": "string",
                      "description": "Ответ одной строкой: «7 рулонов»"
                    },
                    "quantity": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Сколько купить; null, если известна только площадь"
                    },
                    "unit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "exact",
                        "area"
                      ],
                      "description": "exact — рулоны, упаковки, банки; area — только площадь"
                    },
                    "breakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "total": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "label",
                          "value"
                        ]
                      },
                      "description": "Как посчитано"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "Числа расчёта: strips, rolls, packs, litres, cans, площади в м²"
                    },
                    "input_summary": {
                      "type": "string",
                      "description": "С какими данными посчитано"
                    },
                    "assumptions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Что не задано и взято по умолчанию (высота 2,7 м, два слоя)"
                    },
                    "ignored_params": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Параметры запроса, которых калькулятор не знает"
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Параметр → почему не прочитался; при ошибках расчёта нет"
                    },
                    "surface": {
                      "type": "string",
                      "enum": [
                        "floor",
                        "walls",
                        "ceiling"
                      ],
                      "description": "Какая поверхность посчитана"
                    },
                    "surface_area_m2": {
                      "type": "number",
                      "description": "Площадь поверхности до запаса, м²"
                    },
                    "hint": {
                      "type": "string",
                      "description": "При mode: area — какого параметра не хватает до точного числа"
                    },
                    "ignored_hint": {
                      "type": "string",
                      "description": "Где взять список параметров"
                    },
                    "message": {
                      "type": "string",
                      "description": "Что сделать, если ok: false"
                    },
                    "blocker": {
                      "type": "string",
                      "enum": [
                        "missingRoom",
                        "missingPerimeter",
                        "missingInputs",
                        "invalidInput"
                      ],
                      "description": "Почему расчёта нет (при ok: false)"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "Параметры калькулятора (при ok: false)"
                    },
                    "example_url": {
                      "type": "string",
                      "description": "Рабочий пример запроса (при ok: false)"
                    },
                    "page_url": {
                      "type": "string",
                      "description": "Тот же расчёт на странице для человека: дайте его пользователю, чтобы проверить и поменять параметры"
                    },
                    "method_url": {
                      "type": "string",
                      "description": "Как устроен расчёт: формулы и допущения"
                    },
                    "app_url": {
                      "type": "string",
                      "description": "Установка приложения «Благоустрой» с этим калькулятором"
                    },
                    "source": {
                      "type": "string",
                      "description": "Источник расчёта для ссылки в ответе"
                    }
                  },
                  "required": [
                    "ok",
                    "calculator",
                    "title",
                    "input",
                    "page_url",
                    "source"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Параметр не удалось прочитать; errors называет какой и почему."
          }
        }
      }
    },
    "/calculators/api/floor": {
      "get": {
        "operationId": "calculate_floor",
        "summary": "Калькулятор ламината, кварцвинила и паркета",
        "description": "Ламинат, кварцвинил и паркет считают по площади пола с запасом под способ укладки: 5 % при прямой, 10 % по диагонали и 15 % ёлочкой. Площадь с запасом делят на площадь упаковки и округляют вверх. Для комнаты 5 × 4 м и упаковки 1,96 м² при прямой укладке нужно 11 упаковок.\n\nПример: https://erablaga.ru/calculators/api/floor?length=5&width=4&pattern=straight&pack_area=1.96 — 11 упаковок.",
        "parameters": [
          {
            "name": "length",
            "in": "query",
            "required": false,
            "description": "Длина комнаты, м. Синонимы имени: room_length, length_m, l",
            "schema": {
              "type": "number"
            },
            "example": "4"
          },
          {
            "name": "width",
            "in": "query",
            "required": false,
            "description": "Ширина комнаты, м. Синонимы имени: room_width, width_m, w",
            "schema": {
              "type": "number"
            },
            "example": "3"
          },
          {
            "name": "height",
            "in": "query",
            "required": false,
            "description": "Высота стен (потолка), м; если не задана, берётся 2,7 м, и это сказано в assumptions. Синонимы имени: room_height, ceiling_height, wall_height, height_m, h",
            "schema": {
              "type": "number"
            },
            "example": "2.7"
          },
          {
            "name": "area",
            "in": "query",
            "required": false,
            "description": "Площадь пола, м², вместо длины и ширины. Для стен тогда нужен perimeter. Синонимы имени: floor_area, room_area, area_m2",
            "schema": {
              "type": "number"
            },
            "example": "18"
          },
          {
            "name": "perimeter",
            "in": "query",
            "required": false,
            "description": "Периметр стен, м. Синонимы имени: perimeter_m",
            "schema": {
              "type": "number"
            },
            "example": "17"
          },
          {
            "name": "doors",
            "in": "query",
            "required": false,
            "description": "Число дверей 0,9 × 2,1 м. Синонимы имени: door",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "windows",
            "in": "query",
            "required": false,
            "description": "Число окон 1,4 × 1,5 м. Синонимы имени: window",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "openings",
            "in": "query",
            "required": false,
            "description": "Проёмы своих размеров через точку с запятой: ширина x высота [x количество], м. Например 0.8x2x2;2.4x2.1",
            "schema": {
              "type": "string"
            },
            "example": "0.8x2x2;2.4x2.1"
          },
          {
            "name": "pattern",
            "in": "query",
            "required": false,
            "description": "Укладка: прямая (запас 5 %), диагональ (10 %), ёлочка (15 %); по умолчанию straight. Синонимы имени: layout",
            "schema": {
              "type": "string",
              "enum": [
                "straight",
                "diagonal",
                "herringbone"
              ]
            },
            "example": "straight"
          },
          {
            "name": "waste",
            "in": "query",
            "required": false,
            "description": "Свой запас на подрезку, % (вместо запаса по укладке). Синонимы имени: waste_percent, reserve",
            "schema": {
              "type": "number"
            },
            "example": "7"
          },
          {
            "name": "pack_area",
            "in": "query",
            "required": false,
            "description": "Площадь в упаковке, м². Без неё ответ в м² с запасом. Синонимы имени: pack, pack_m2, box_area",
            "schema": {
              "type": "number"
            },
            "example": "1.96"
          }
        ],
        "responses": {
          "200": {
            "description": "Расчёт или причина, по которой посчитать нельзя (ok: false, message говорит, каких параметров не хватает).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "calculator": {
                      "type": "string",
                      "enum": [
                        "wallpaper",
                        "tile",
                        "floor",
                        "paint"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Понятые параметры запроса под основными именами"
                    },
                    "summary": {
                      "type": "string",
                      "description": "Ответ одной строкой: «7 рулонов»"
                    },
                    "quantity": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Сколько купить; null, если известна только площадь"
                    },
                    "unit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "exact",
                        "area"
                      ],
                      "description": "exact — рулоны, упаковки, банки; area — только площадь"
                    },
                    "breakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "total": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "label",
                          "value"
                        ]
                      },
                      "description": "Как посчитано"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "Числа расчёта: strips, rolls, packs, litres, cans, площади в м²"
                    },
                    "input_summary": {
                      "type": "string",
                      "description": "С какими данными посчитано"
                    },
                    "assumptions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Что не задано и взято по умолчанию (высота 2,7 м, два слоя)"
                    },
                    "ignored_params": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Параметры запроса, которых калькулятор не знает"
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Параметр → почему не прочитался; при ошибках расчёта нет"
                    },
                    "surface": {
                      "type": "string",
                      "enum": [
                        "floor",
                        "walls",
                        "ceiling"
                      ],
                      "description": "Какая поверхность посчитана"
                    },
                    "surface_area_m2": {
                      "type": "number",
                      "description": "Площадь поверхности до запаса, м²"
                    },
                    "hint": {
                      "type": "string",
                      "description": "При mode: area — какого параметра не хватает до точного числа"
                    },
                    "ignored_hint": {
                      "type": "string",
                      "description": "Где взять список параметров"
                    },
                    "message": {
                      "type": "string",
                      "description": "Что сделать, если ok: false"
                    },
                    "blocker": {
                      "type": "string",
                      "enum": [
                        "missingRoom",
                        "missingPerimeter",
                        "missingInputs",
                        "invalidInput"
                      ],
                      "description": "Почему расчёта нет (при ok: false)"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "Параметры калькулятора (при ok: false)"
                    },
                    "example_url": {
                      "type": "string",
                      "description": "Рабочий пример запроса (при ok: false)"
                    },
                    "page_url": {
                      "type": "string",
                      "description": "Тот же расчёт на странице для человека: дайте его пользователю, чтобы проверить и поменять параметры"
                    },
                    "method_url": {
                      "type": "string",
                      "description": "Как устроен расчёт: формулы и допущения"
                    },
                    "app_url": {
                      "type": "string",
                      "description": "Установка приложения «Благоустрой» с этим калькулятором"
                    },
                    "source": {
                      "type": "string",
                      "description": "Источник расчёта для ссылки в ответе"
                    }
                  },
                  "required": [
                    "ok",
                    "calculator",
                    "title",
                    "input",
                    "page_url",
                    "source"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Параметр не удалось прочитать; errors называет какой и почему."
          }
        }
      }
    },
    "/calculators/api/paint": {
      "get": {
        "operationId": "calculate_paint",
        "summary": "Калькулятор краски для стен и потолка",
        "description": "Краску считают так: площадь стен за вычетом дверей и окон умножают на число слоёв и делят на расход в м² на литр. Если расход указан диапазоном, например 8–11 м²/л, берут меньшее число: на пористой стене краски уходит больше. Стены комнаты 4 × 3 м с дверью в два слоя при расходе 8 м²/л требуют почти 9 л (8,98 л): одна банка 9 л, впритык.\n\nПример: https://erablaga.ru/calculators/api/paint?length=4&width=3&height=2.7&doors=1&layers=2&coverage=8-11&can=9 — 1 банка 9 л: краски нужно почти 9 л, впритык.",
        "parameters": [
          {
            "name": "length",
            "in": "query",
            "required": false,
            "description": "Длина комнаты, м. Синонимы имени: room_length, length_m, l",
            "schema": {
              "type": "number"
            },
            "example": "4"
          },
          {
            "name": "width",
            "in": "query",
            "required": false,
            "description": "Ширина комнаты, м. Синонимы имени: room_width, width_m, w",
            "schema": {
              "type": "number"
            },
            "example": "3"
          },
          {
            "name": "height",
            "in": "query",
            "required": false,
            "description": "Высота стен (потолка), м; если не задана, берётся 2,7 м, и это сказано в assumptions. Синонимы имени: room_height, ceiling_height, wall_height, height_m, h",
            "schema": {
              "type": "number"
            },
            "example": "2.7"
          },
          {
            "name": "area",
            "in": "query",
            "required": false,
            "description": "Площадь пола, м², вместо длины и ширины. Для стен тогда нужен perimeter. Синонимы имени: floor_area, room_area, area_m2",
            "schema": {
              "type": "number"
            },
            "example": "18"
          },
          {
            "name": "perimeter",
            "in": "query",
            "required": false,
            "description": "Периметр стен, м. Синонимы имени: perimeter_m",
            "schema": {
              "type": "number"
            },
            "example": "17"
          },
          {
            "name": "doors",
            "in": "query",
            "required": false,
            "description": "Число дверей 0,9 × 2,1 м. Синонимы имени: door",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "windows",
            "in": "query",
            "required": false,
            "description": "Число окон 1,4 × 1,5 м. Синонимы имени: window",
            "schema": {
              "type": "integer"
            },
            "example": "1"
          },
          {
            "name": "openings",
            "in": "query",
            "required": false,
            "description": "Проёмы своих размеров через точку с запятой: ширина x высота [x количество], м. Например 0.8x2x2;2.4x2.1",
            "schema": {
              "type": "string"
            },
            "example": "0.8x2x2;2.4x2.1"
          },
          {
            "name": "surface",
            "in": "query",
            "required": false,
            "description": "Что красим (по умолчанию walls)",
            "schema": {
              "type": "string",
              "enum": [
                "walls",
                "ceiling",
                "floor"
              ]
            },
            "example": "walls"
          },
          {
            "name": "layers",
            "in": "query",
            "required": false,
            "description": "Слоёв (по умолчанию 2). Синонимы имени: coats",
            "schema": {
              "type": "integer"
            },
            "example": "2"
          },
          {
            "name": "coverage",
            "in": "query",
            "required": false,
            "description": "Расход с этикетки, м² на литр: число или диапазон «8-11» (считаем по меньшему). Не литры на м². Синонимы имени: spreading_rate, coverage_m2_per_l",
            "schema": {
              "type": "string"
            },
            "example": "8-11"
          },
          {
            "name": "can",
            "in": "query",
            "required": false,
            "description": "Объём банки, л. Синонимы имени: can_volume, volume, tin, container",
            "schema": {
              "type": "number"
            },
            "example": "9"
          }
        ],
        "responses": {
          "200": {
            "description": "Расчёт или причина, по которой посчитать нельзя (ok: false, message говорит, каких параметров не хватает).",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object",
                  "properties": {
                    "ok": {
                      "type": "boolean"
                    },
                    "calculator": {
                      "type": "string",
                      "enum": [
                        "wallpaper",
                        "tile",
                        "floor",
                        "paint"
                      ]
                    },
                    "title": {
                      "type": "string"
                    },
                    "input": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Понятые параметры запроса под основными именами"
                    },
                    "summary": {
                      "type": "string",
                      "description": "Ответ одной строкой: «7 рулонов»"
                    },
                    "quantity": {
                      "type": [
                        "integer",
                        "null"
                      ],
                      "description": "Сколько купить; null, если известна только площадь"
                    },
                    "unit": {
                      "type": [
                        "string",
                        "null"
                      ]
                    },
                    "mode": {
                      "type": "string",
                      "enum": [
                        "exact",
                        "area"
                      ],
                      "description": "exact — рулоны, упаковки, банки; area — только площадь"
                    },
                    "breakdown": {
                      "type": "array",
                      "items": {
                        "type": "object",
                        "properties": {
                          "label": {
                            "type": "string"
                          },
                          "value": {
                            "type": "string"
                          },
                          "total": {
                            "type": "boolean"
                          }
                        },
                        "required": [
                          "label",
                          "value"
                        ]
                      },
                      "description": "Как посчитано"
                    },
                    "notes": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      }
                    },
                    "details": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "number"
                      },
                      "description": "Числа расчёта: strips, rolls, packs, litres, cans, площади в м²"
                    },
                    "input_summary": {
                      "type": "string",
                      "description": "С какими данными посчитано"
                    },
                    "assumptions": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Что не задано и взято по умолчанию (высота 2,7 м, два слоя)"
                    },
                    "ignored_params": {
                      "type": "array",
                      "items": {
                        "type": "string"
                      },
                      "description": "Параметры запроса, которых калькулятор не знает"
                    },
                    "errors": {
                      "type": "object",
                      "additionalProperties": {
                        "type": "string"
                      },
                      "description": "Параметр → почему не прочитался; при ошибках расчёта нет"
                    },
                    "surface": {
                      "type": "string",
                      "enum": [
                        "floor",
                        "walls",
                        "ceiling"
                      ],
                      "description": "Какая поверхность посчитана"
                    },
                    "surface_area_m2": {
                      "type": "number",
                      "description": "Площадь поверхности до запаса, м²"
                    },
                    "hint": {
                      "type": "string",
                      "description": "При mode: area — какого параметра не хватает до точного числа"
                    },
                    "ignored_hint": {
                      "type": "string",
                      "description": "Где взять список параметров"
                    },
                    "message": {
                      "type": "string",
                      "description": "Что сделать, если ok: false"
                    },
                    "blocker": {
                      "type": "string",
                      "enum": [
                        "missingRoom",
                        "missingPerimeter",
                        "missingInputs",
                        "invalidInput"
                      ],
                      "description": "Почему расчёта нет (при ok: false)"
                    },
                    "parameters": {
                      "type": "array",
                      "items": {
                        "type": "object"
                      },
                      "description": "Параметры калькулятора (при ok: false)"
                    },
                    "example_url": {
                      "type": "string",
                      "description": "Рабочий пример запроса (при ok: false)"
                    },
                    "page_url": {
                      "type": "string",
                      "description": "Тот же расчёт на странице для человека: дайте его пользователю, чтобы проверить и поменять параметры"
                    },
                    "method_url": {
                      "type": "string",
                      "description": "Как устроен расчёт: формулы и допущения"
                    },
                    "app_url": {
                      "type": "string",
                      "description": "Установка приложения «Благоустрой» с этим калькулятором"
                    },
                    "source": {
                      "type": "string",
                      "description": "Источник расчёта для ссылки в ответе"
                    }
                  },
                  "required": [
                    "ok",
                    "calculator",
                    "title",
                    "input",
                    "page_url",
                    "source"
                  ]
                }
              }
            }
          },
          "400": {
            "description": "Параметр не удалось прочитать; errors называет какой и почему."
          }
        }
      }
    }
  }
}