{
  "openapi": "3.0.0",
  "info": {
    "title": "paid-api/activetruckers",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "/"
    },
    {
      "url": "https://api.ati.su"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/v2/dstats/active_firms/search": {
      "post": {
        "parameters": [
          {
            "description": "Использовать демо-режим",
            "in": "query",
            "name": "demo",
            "schema": {
              "default": false,
              "type": "boolean"
            },
            "x-nullable": false
          }
        ],
        "responses": {
          "200": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/ActiveFirmsViewOfActiveFirmsResultViewV2"
                }
              }
            },
            "description": "Активные перевозчики",
            "x-nullable": false
          },
          "400": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/FinalExceptionView"
                }
              }
            },
            "description": "Ошибка в запросе",
            "x-nullable": false
          },
          "403": {
            "content": {
              "*/*": {
                "schema": {
                  "$ref": "#/components/schemas/FinalExceptionView"
                }
              }
            },
            "description": "У вас нет доступа к данному API",
            "x-nullable": false
          }
        },
        "security": [
          {
            "JWT": []
          }
        ],
        "tags": [
          "API активных перевозчиков"
        ],
        "operationId": "ActiveFirms_SearchActiveTruckers",
        "requestBody": {
          "content": {
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/ActiveTruckersWithActualGeoDto"
              }
            },
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ActiveTruckersWithActualGeoDto"
              }
            },
            "application/json-patch+json": {
              "schema": {
                "$ref": "#/components/schemas/ActiveTruckersWithActualGeoDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/ActiveTruckersWithActualGeoDto"
              }
            }
          },
          "description": "Параметры запроса"
        },
        "summary": "Получение активных перевозчиков по заданным параметрам"
      }
    }
  },
  "components": {
    "schemas": {
      "ActiveFirmsResultViewV2": {
        "properties": {
          "actual_trucks_count": {
            "description": "Сколько в данный момент у пользователя есть машин по этому направлению",
            "format": "int32",
            "type": "integer"
          },
          "id": {
            "description": "ID фирмы",
            "type": "string"
          },
          "inn": {
            "description": "ИНН фирмы, если указан",
            "type": "string"
          },
          "search_count": {
            "description": "Сколько за период представители этой фирмы искали грузы по выбранному направлению",
            "format": "int32",
            "type": "integer"
          },
          "sum_count": {
            "description": "Сумма search_count и trucks_count",
            "format": "int32",
            "type": "integer"
          },
          "trucks_count": {
            "description": "Сколько за период представители этой фирмы размещали машин по выбранному направлению на вкладке \"Транспорт\"",
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "search_count",
          "trucks_count",
          "sum_count",
          "actual_trucks_count"
        ],
        "type": "object"
      },
      "ActiveFirmsViewOfActiveFirmsResultViewV2": {
        "properties": {
          "is_demo": {
            "description": "Это демо-данные?",
            "type": "boolean"
          },
          "ok": {
            "description": "Успешно?",
            "type": "boolean"
          },
          "result": {
            "description": "Список активных фирм",
            "items": {
              "$ref": "#/components/schemas/ActiveFirmsResultViewV2"
            },
            "type": "array"
          }
        },
        "required": [
          "ok",
          "is_demo",
          "result"
        ],
        "type": "object"
      },
      "ActiveTruckersGeoDto": {
        "properties": {
          "begin_date": {
            "description": "Дата, от которой ведется поиск активных фирм в формате ISO-8601",
            "format": "date-time",
            "type": "string"
          },
          "from": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Geo"
              }
            ],
            "description": "Локация: откуда"
          },
          "to": {
            "allOf": [
              {
                "$ref": "#/components/schemas/Geo"
              }
            ],
            "description": "Локация: куда"
          },
          "truck_type": {
            "description": "Маска типа кузова\\\nЗначение из [словаря кузовов ATI.SU](https://ati.su/developers/api/dictionaries/cargoes/#get-v1.0-dictionaries-carTypes)",
            "format": "int64",
            "type": "integer"
          },
          "truck_volume": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ValueRange"
              }
            ],
            "description": "Диапазон объёма кузова в метрах кубических"
          },
          "truck_weight": {
            "allOf": [
              {
                "$ref": "#/components/schemas/ValueRange"
              }
            ],
            "description": "Диапазон грузоподъёмности в тоннах"
          },
          "volume": {
            "description": "Объём в метрах кубических",
            "format": "int32",
            "type": "integer"
          },
          "weight": {
            "description": "Вес в тоннах",
            "format": "int32",
            "type": "integer"
          }
        },
        "required": [
          "begin_date",
          "from",
          "to"
        ],
        "type": "object"
      },
      "ActiveTruckersWithActualGeoDto": {
        "allOf": [
          {
            "$ref": "#/components/schemas/ActiveTruckersGeoDto"
          },
          {
            "properties": {
              "trucks_date_from": {
                "description": "Дата, от которой ведется поиск актуальных машин в формате ISO-8601.\nЕсли отсутствует в запросе, то используется значение `begin_date`",
                "format": "date-time",
                "type": "string"
              },
              "trucks_date_to": {
                "description": "Дата, до которой ведется поиск актуальных машин в формате ISO-8601.\nДолжна быть больше даты начала поиска машин.\nЕсли отсутствует в запросе, то результат поиска не ограничивается сверху",
                "format": "date-time",
                "type": "string"
              }
            },
            "type": "object"
          }
        ]
      },
      "FinalExceptionView": {
        "properties": {
          "details": {
            "description": "Детали ошибки"
          },
          "error_code": {
            "description": "Код ошибки",
            "type": "string"
          },
          "error_list": {
            "description": "Список вложенных ошибок",
            "items": {
              "$ref": "#/components/schemas/FinalExceptionView"
            },
            "type": "array"
          },
          "reason": {
            "description": "Причина ошибки",
            "type": "string"
          }
        },
        "required": [
          "error_code",
          "reason",
          "details",
          "error_list"
        ],
        "type": "object"
      },
      "Geo": {
        "properties": {
          "id": {
            "description": "Id локации\\\nЗначение из [словаря](https://ati.su/developers/api/dictionaries/geo/)",
            "format": "int32",
            "type": "integer"
          },
          "type": {
            "allOf": [
              {
                "$ref": "#/components/schemas/GeoType"
              }
            ],
            "description": "Тип локации\n            \n* `0` - страна\n* `1` - регион\n* `2` - город"
          }
        },
        "required": [
          "id",
          "type"
        ],
        "type": "object"
      },
      "GeoType": {
        "description": "Тип локации\n            \n* `0` - страна\n* `1` - регион\n* `2` - город",
        "enum": [
          0,
          1,
          2
        ],
        "type": "integer",
        "x-enumNames": [
          "Country",
          "Region",
          "City"
        ]
      },
      "ValueRange": {
        "properties": {
          "from": {
            "description": "Значение от",
            "format": "int32",
            "type": "integer"
          },
          "to": {
            "description": "Значение до",
            "format": "int32",
            "type": "integer"
          }
        },
        "type": "object"
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Authorization: Bearer {authorizationToken}"
      },
      "JWT": {
        "description": "Bearer {access_token}",
        "in": "header",
        "name": "Authorization",
        "type": "apiKey"
      }
    }
  }
}