{
  "openapi": "3.0.0",
  "info": {
    "title": "api/orders/documents",
    "version": "1.0.0"
  },
  "servers": [
    {
      "url": "/"
    },
    {
      "url": "https://api.ati.su"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    }
  ],
  "paths": {
    "/v1.2/orders/documents/{parentDocumentId}/invoice": {
      "post": {
        "tags": [
          "Создание документов"
        ],
        "summary": "Создание счета",
        "description": "Позволяет перевозчику и грузовладельцу создать счет для Заказа, оформленного через систему АТИ-Доки, для Заказа в статусах: исполнение, документы и оплата, в архиве",
        "operationId": "AdditionalDocuments_CreateInvoice",
        "parameters": [
          {
            "name": "parentDocumentId",
            "in": "path",
            "required": true,
            "description": "Id документа",
            "schema": {
              "type": "string"
            },
            "x-position": 1
          }
        ],
        "responses": {
          "200": {
            "description": "Возвращает информацию по счету",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMinView"
                }
              }
            }
          },
          "4XX": {
            "description": "Ошибка запроса. [Подробнее про ошибки API](https://ati.su/developers/documentation/errors/)",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FinalExceptionModelOfFinalException"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": []
          }
        ]
      }
    },
    "/v1.2/orders/documents/{parentDocumentId}/act": {
      "post": {
        "tags": [
          "Создание документов"
        ],
        "summary": "Создание акта",
        "description": "Позволяет перевозчику и грузовладельцу создать двухсторонний акт для Заказа, оформленного через систему АТИ-Доки, для Заказа в статусах: исполнение, документы и оплата, в архиве",
        "operationId": "AdditionalDocuments_CreateAct",
        "parameters": [
          {
            "name": "parentDocumentId",
            "in": "path",
            "required": true,
            "description": "Id документа",
            "schema": {
              "type": "string"
            },
            "x-position": 1
          }
        ],
        "responses": {
          "200": {
            "description": "Возвращает информацию по акту",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMinView"
                }
              }
            }
          },
          "4XX": {
            "description": "Ошибка запроса. [Подробнее про ошибки API](https://ati.su/developers/documentation/errors/)",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FinalExceptionModelOfFinalException"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": []
          }
        ]
      }
    },
    "/v1.2/orders/documents/{parentDocumentId}/unilateral_dissolution": {
      "post": {
        "tags": [
          "Создание документов"
        ],
        "summary": "Создание уведомления о расторжении",
        "description": "Позволяет перевозчику и грузовладельцу создать уведомление об отклонении Заказа, оформленного через систему АТИ-Доки, для Заказа в исполнении",
        "operationId": "AdditionalDocuments_CreateUnilateralDissolution",
        "parameters": [
          {
            "name": "parentDocumentId",
            "in": "path",
            "required": true,
            "description": "Id документа",
            "schema": {
              "type": "string"
            },
            "x-position": 1
          }
        ],
        "responses": {
          "200": {
            "description": "Возвращает информацию по уведомлению",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DocumentMinView"
                }
              }
            }
          },
          "4XX": {
            "description": "Ошибка запроса. [Подробнее про ошибки API](https://ati.su/developers/documentation/errors/)",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FinalExceptionModelOfFinalException"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": []
          }
        ]
      }
    },
    "/v1.2/orders/docs/{documentId}/access": {
      "put": {
        "tags": [
          "Документы в заказах"
        ],
        "summary": "Настройка доступа к документу заказа",
        "operationId": "Docs_ChangeAccess",
        "parameters": [
          {
            "name": "documentId",
            "in": "path",
            "required": true,
            "description": "Id документа",
            "schema": {
              "type": "string",
              "format": "guid"
            },
            "x-position": 1
          }
        ],
        "requestBody": {
          "x-name": "dto",
          "description": "Настройка доступа",
          "content": {
            "application/json": {
              "schema": {
                "nullable": true,
                "oneOf": [
                  {
                    "$ref": "#/components/schemas/DealDocumentAccessDto"
                  }
                ]
              }
            }
          },
          "x-position": 2
        },
        "responses": {
          "200": {
            "description": "Успешное изменение доступа",
            "content": {
              "application/octet-stream": {
                "schema": {
                  "type": "string",
                  "format": "binary"
                }
              }
            }
          },
          "4XX": {
            "description": "Ошибка запроса. [Подробнее про ошибки API](https://ati.su/developers/documentation/errors/)",
            "content": {
              "application/json": {
                "schema": {
                  "nullable": true,
                  "oneOf": [
                    {
                      "$ref": "#/components/schemas/FinalExceptionModelOfFinalException"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "JWT": []
          }
        ]
      }
    }
  },
  "components": {
    "schemas": {
      "DealDocumentAccess": {
        "type": "integer",
        "description": "Доступ к документу\n            \n* `0` — Обе стороны\n* `1` — Водитель",
        "x-enumFlags": true,
        "x-enumNames": [
          "SharedWithCounterparty",
          "SharedWithAtiTrucker"
        ],
        "enum": [
          0,
          1
        ]
      },
      "DealDocumentAccessDto": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "access": {
            "description": "Доступ к документу",
            "oneOf": [
              {
                "$ref": "#/components/schemas/DealDocumentAccess"
              }
            ]
          },
          "timeslots_warehouse_ids": {
            "type": "array",
            "description": "Список складов с Временными окнами с доступом к документу",
            "items": {
              "type": "integer",
              "format": "int32"
            }
          }
        }
      },
      "FinalExceptionModelOfFinalException": {
        "type": "object",
        "description": "Модель ошибки",
        "additionalProperties": false,
        "properties": {
          "reason": {
            "type": "string",
            "description": "Причина ошибки"
          },
          "error": {
            "type": "string",
            "description": "Ключ ошибки"
          }
        }
      },
      "DocumentMinView": {
        "type": "object",
        "additionalProperties": false,
        "properties": {
          "document_id": {
            "type": "string",
            "description": "ID документа"
          },
          "url": {
            "type": "string",
            "description": "Адрес просмотра договора"
          }
        }
      }
    },
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT",
        "description": "Authorization: Bearer {authorizationToken}"
      }
    }
  }
}