{
  "openapi": "3.0.3",
  "info": {
    "title": "hidden/recommended_price",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "/"
    },
    {
      "url": "https://api.ati.su"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/gw/norn/v2/all_directions": {
      "get": {
        "summary": "Возвращает список доступных направлений - для интеграторов",
        "operationId": "get_all_directions_v2_all_directions_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllDirectionsResponseV1",
                  "type": "string",
                  "title": "Response 200 Get All Directions V2 All Directions Get"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorFormatResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gw/norn/v1/all_directions": {
      "get": {
        "summary": "Возвращает список доступных направлений - для интеграторов",
        "operationId": "get_all_directions_v1_all_directions_get",
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AllDirectionsResponseV1",
                  "type": "string",
                  "title": "Response 200 Get All Directions V1 All Directions Get"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorFormatResponse"
                }
              }
            }
          }
        }
      }
    },
    "/gw/norn/v2/chart": {
      "post": {
        "summary": "Возвращает рекомендованные цены, СС и сделки по заданным параметрам",
        "description": "Возвращает рекомендованные цены, СС и сделки по заданным параметрам.\nДоступные направления брать из методов `/all_directions`.\n\nЕсли по направлению нет данных на определённую дату, то соответствующая\nточка в ответе будет отсутствовать и значения в параметрах динамики\nна отсутствующую дату будет `null`.\n\nЗначения `*_line` в ответе отсортированы по убыванию даты в `x`",
        "operationId": "get_priceline_v2_chart_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InputParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteChartResponse",
                  "type": "string",
                  "title": "Response 200 Get Priceline V2 Chart Post"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorFormatResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorFormatResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    },
    "/gw/norn/v1/chart": {
      "post": {
        "summary": "Возвращает рекомендованные цены, СС и сделки по заданным параметрам",
        "description": "Возвращает рекомендованные цены, СС и сделки по заданным параметрам.\nДоступные направления брать из методов `/all_directions`.\n\nЕсли по направлению нет данных на определённую дату, то соответствующая\nточка в ответе будет отсутствовать и значения в параметрах динамики\nна отсутствующую дату будет `null`.\n\nЗначения `*_line` в ответе отсортированы по убыванию даты в `x`",
        "operationId": "get_priceline_v1_chart_post",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/InputParams"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SiteChartResponse",
                  "type": "string",
                  "title": "Response 200 Get Priceline V1 Chart Post"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorFormatResponse"
                }
              }
            }
          },
          "404": {
            "description": "Not Found",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ErrorFormatResponse"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/HTTPValidationError"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AllDirectionsResponseV1": {
        "properties": {
          "all_directions": {
            "items": {
              "$ref": "#/components/schemas/Direction"
            },
            "type": "array",
            "title": "All Directions",
            "description": "Все направления для перевозчика."
          }
        },
        "type": "object",
        "required": [
          "all_directions"
        ],
        "title": "Ответ: список направлений для перевозчика"
      },
      "CarType": {
        "type": "string",
        "enum": [
          "close",
          "open",
          "ref",
          "tent"
        ],
        "title": "CarType",
        "description": "Тип кузова\n* `ref` - рефрижераторы\n* `close` - закрытые. Значение по умолчанию\n* `open` - открытые\n* `tent` - тентованный\n      "
      },
      "DealPoint": {
        "properties": {
          "x": {
            "type": "string",
            "title": "Дата."
          },
          "y": {
            "items": {
              "type": "number"
            },
            "type": "array",
            "title": "Стоимости сделок",
            "default": []
          }
        },
        "type": "object",
        "required": [
          "x"
        ],
        "title": "Точки графика."
      },
      "Direction": {
        "properties": {
          "from_city_id": {
            "type": "integer",
            "title": "ID пункта загрузки",
            "description": "ID пункта загрузки"
          },
          "from_city": {
            "type": "string",
            "title": "Название пункта загрузки",
            "description": "Название пункта загрузки"
          },
          "to_city_id": {
            "type": "integer",
            "title": "ID пункта разгрузки",
            "description": "ID пункта разгрузки"
          },
          "to_city": {
            "type": "string",
            "title": "Название пункта разгрузки",
            "description": "Название пункта разгрузки"
          },
          "car_types": {
            "items": {
              "$ref": "#/components/schemas/CarType"
            },
            "type": "array",
            "title": "Доступные типы кузовов для направления",
            "description": "Доступные типы кузовов для направления"
          }
        },
        "type": "object",
        "required": [
          "from_city_id",
          "from_city",
          "to_city_id",
          "to_city",
          "car_types"
        ],
        "title": "Подпараметр ответа: одно направление для перевозчика"
      },
      "DisplayedPeriod": {
        "type": "string",
        "enum": [
          "3m",
          "6m",
          "ytd",
          "1y",
          "3y",
          "alltime"
        ],
        "title": "DisplayedPeriod",
        "description": "Временной интервал \n* `3m` - за 3 месяца\n* `6m` - за 6 месяцев\n* `ytd` - с начала текущего года\n* `1y` - за год\n* `3y` - за 3 года\n* `alltime` - за все время"
      },
      "ErrorFormatResponse": {
        "properties": {
          "error": {
            "type": "string",
            "title": "Error",
            "description": "Основное тело ошибки с описанием"
          },
          "reason": {
            "type": "string",
            "title": "Reason",
            "description": "Тип ошибки если имеется"
          },
          "details": {
            "additionalProperties": true,
            "type": "object",
            "title": "Details",
            "description": "Какие-либо дополнительные детали ошибки"
          }
        },
        "type": "object",
        "required": [
          "error",
          "reason",
          "details"
        ],
        "title": "Ответ: Формат ответа при ошибке"
      },
      "Graph": {
        "properties": {
          "x": {
            "type": "string",
            "title": "Дата."
          },
          "y": {
            "type": "number",
            "title": "Рекомендуемая цена"
          }
        },
        "type": "object",
        "required": [
          "x",
          "y"
        ],
        "title": "Точка графика."
      },
      "GraphHist": {
        "properties": {
          "x": {
            "type": "string",
            "title": "Дата."
          },
          "y": {
            "type": "number",
            "title": "Рекомендуемая цена"
          },
          "h": {
            "type": "integer",
            "title": "Надежность прогноза."
          }
        },
        "type": "object",
        "required": [
          "x",
          "y",
          "h"
        ],
        "title": "Точка графика со столбцом гистограммы."
      },
      "HTTPValidationError": {
        "properties": {
          "detail": {
            "items": {
              "$ref": "#/components/schemas/ValidationError"
            },
            "type": "array",
            "title": "Detail"
          }
        },
        "type": "object",
        "title": "HTTPValidationError"
      },
      "InputParams": {
        "properties": {
          "time_interval": {
            "allOf": [
              {
                "$ref": "#/components/schemas/DisplayedPeriod"
              }
            ],
            "description": "Временной интервал.\n                    Один из ['`DisplayedPeriod.three_months`', '`DisplayedPeriod.six_months`', '`DisplayedPeriod.ytd`', '`DisplayedPeriod.year`', '`DisplayedPeriod.three_years`', '`DisplayedPeriod.alltime`']",
            "default": "3m"
          },
          "from_city": {
            "type": "integer",
            "title": "From City",
            "description": "ID пункта загрузки. Значение поля `id` в структуре `city` из [словаря  ATI.SU](https://ati.su/developers/api/dictionaries/geo/#post-v1-autocomplete-suggestions)"
          },
          "to_city": {
            "type": "integer",
            "title": "To City",
            "description": "ID пункта разгрузки. Значение поля `id` в структуре `city` из [словаря  ATI.SU](https://ati.su/developers/api/dictionaries/geo/#post-v1-autocomplete-suggestions)"
          },
          "car_type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/CarType"
              }
            ],
            "description": "Тип кузова\n* `ref` - рефрижераторы\n* `close` - закрытые. Значение по умолчанию\n* `open` - открытые\n* `tent` - тентованный\n      ",
            "default": "close"
          },
          "users_margin": {
            "type": "number",
            "maximum": 1000,
            "minimum": 0,
            "title": "Users Margin",
            "description": "Маржа.",
            "default": 0
          },
          "nds": {
            "type": "boolean",
            "title": "Nds",
            "description": "Учитывать ли НДС в цене",
            "default": false
          },
          "rate_per_km": {
            "type": "boolean",
            "title": "Rate Per Km",
            "description": "Размерность ставки.\n            * `true` - в руб/км.\n            * `false` - в руб.\n            ",
            "default": true
          },
          "priority": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Priority"
              }
            ],
            "description": "Приоритет данных при рассчетах.\n                        * `mixed` - баланс;\n                        * `partner` - ваши данные;\n                        * `ati` - данные ATI.SU.\n                        ",
            "default": "mixed"
          }
        },
        "type": "object",
        "required": [
          "from_city",
          "to_city"
        ],
        "title": "Запрос: Входные параметры для получения рекомендации",
        "example": {
          "car_type": "close",
          "from_city": 1,
          "nds": false,
          "priority": "mixed",
          "rate_per_km": true,
          "time_interval": "3m",
          "to_city": 3611,
          "users_margin": 0
        }
      },
      "Priority": {
        "type": "string",
        "enum": [
          "ati",
          "partner",
          "mixed"
        ],
        "title": "Priority",
        "example": "mixed",
        "description": "Приоритет данных при рассчетах\n* `mixed` - баланс\n* `partner` - ваши данные\n* `ati` - данные ATI.SU\n"
      },
      "SiteChartResponse": {
        "properties": {
          "average_line": {
            "anyOf": [
              {
                "items": {
                  "$ref": "#/components/schemas/Graph"
                },
                "type": "array"
              },
              {
                "type": "null"
              }
            ],
            "title": "Средние цены в грузах на ATI.SU "
          },
          "recomended_line": {
            "items": {
              "$ref": "#/components/schemas/GraphHist"
            },
            "type": "array",
            "title": "Рекомендуемая цена с учетом маржи"
          },
          "your_executor_deals": {
            "items": {
              "$ref": "#/components/schemas/DealPoint"
            },
            "type": "array",
            "title": "Ваши сделки с исполнителем"
          },
          "your_customer_deals": {
            "items": {
              "$ref": "#/components/schemas/DealPoint"
            },
            "type": "array",
            "title": "Ваши сделки с заказчиком"
          },
          "other_executor_deals": {
            "items": {
              "$ref": "#/components/schemas/DealPoint"
            },
            "type": "array",
            "title": "Сделки других партнеров с исполнителем"
          },
          "current_price": {
            "type": "number",
            "title": "Текущая цена в руб/км"
          },
          "current_cost": {
            "type": "number",
            "title": "Текущая стоимость за заданное расстояние в рублях"
          },
          "current_date": {
            "type": "string",
            "title": "Дата последнего дня, на который есть прогноз."
          },
          "confidence_level": {
            "type": "integer",
            "title": "Надежность прогноза на текущий день."
          },
          "mean_margin": {
            "type": "number",
            "title": "Средняя маржа по направлению за год."
          },
          "max_margin": {
            "type": "number",
            "title": "Максимальная маржа по направлению за год."
          },
          "min_margin": {
            "type": "number",
            "title": "Минимальная маржа по направлению за год."
          },
          "distance": {
            "type": "integer",
            "title": "Расстояние между выбранными городами"
          }
        },
        "type": "object",
        "required": [
          "current_price",
          "current_cost",
          "current_date",
          "confidence_level",
          "mean_margin",
          "max_margin",
          "min_margin",
          "distance"
        ],
        "title": "Ответ: Рекомендованные цены, СС и сделки по заданным параметрам"
      },
      "ValidationError": {
        "properties": {
          "loc": {
            "items": {
              "anyOf": [
                {
                  "type": "string"
                },
                {
                  "type": "integer"
                }
              ]
            },
            "type": "array",
            "title": "Location"
          },
          "msg": {
            "type": "string",
            "title": "Message"
          },
          "type": {
            "type": "string",
            "title": "Error Type"
          }
        },
        "type": "object",
        "required": [
          "loc",
          "msg",
          "type"
        ],
        "title": "ValidationError"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Authorization: Bearer {authorizationToken}"
      }
    }
  }
}