{
  "openapi": "3.0.4",
  "info": {
    "title": "VOCA API Android",
    "version": "v1.0"
  },
  "paths": {
    "/api/audiorecords": {
      "post": {
        "tags": [
          "AudioRecords"
        ],
        "summary": "Загрузить аудиозапись",
        "parameters": [
          {
            "name": "audioEndDate",
            "in": "query",
            "description": "Дата окончания записи аудио",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "employeeId",
            "in": "query",
            "description": "Id сотрудника",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "durationSec",
            "in": "query",
            "description": "Длительность вудио в секундах",
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "isEncrypted",
            "in": "query",
            "description": "Зашифрован ли файл",
            "schema": {
              "type": "boolean",
              "default": false
            }
          },
          {
            "name": "audioCaptureSource",
            "in": "query",
            "description": "Источник записи файла (PhoneMicrophone/WearableBadge/Mixed). Необязательный, обратно совместимый параметр.",
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "multipart/form-data": {
              "schema": {
                "type": "object",
                "properties": {
                  "file": {
                    "type": "string",
                    "description": "Аудиофайл",
                    "format": "binary"
                  }
                }
              },
              "encoding": {
                "file": {
                  "style": "form"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK"
          }
        }
      }
    },
    "/api/devices/{securityKey}/token": {
      "get": {
        "tags": [
          "Devices"
        ],
        "summary": "Получить токен для запросов от имени конкретного устройства",
        "parameters": [
          {
            "name": "securityKey",
            "in": "path",
            "description": "Ключ устройства",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "JWT токен",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "string"
                }
              },
              "application/json": {
                "schema": {
                  "type": "string"
                }
              },
              "text/json": {
                "schema": {
                  "type": "string"
                }
              }
            }
          },
          "400": {
            "description": "Некорректный ключ устройства"
          }
        }
      }
    },
    "/api/devices/current": {
      "get": {
        "tags": [
          "Devices"
        ],
        "summary": "Получить информацию о текущем устройстве",
        "responses": {
          "200": {
            "description": "DeviceDto",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/DeviceDto"
                }
              }
            }
          }
        }
      }
    },
    "/api/employees/all": {
      "get": {
        "tags": [
          "Employees"
        ],
        "summary": "Список всех сотрудников",
        "responses": {
          "200": {
            "description": "EmployeeDto[]",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EmployeeDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EmployeeDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/EmployeeDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/employees/{id}/log-on": {
      "post": {
        "tags": [
          "Employees"
        ],
        "summary": "Авторизация сотрудника на текущем устройстве",
        "parameters": [
          {
            "name": "id",
            "in": "path",
            "description": "ID сотрудника",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "204": {
            "description": "Сотрудник авторизован на устройстве"
          },
          "400": {
            "description": "Ошибка авторизации"
          },
          "404": {
            "description": "Сотрудник не найден"
          }
        }
      }
    },
    "/api/employees/log-off": {
      "post": {
        "tags": [
          "Employees"
        ],
        "summary": "Окончание авторизации на текущем устройстве",
        "responses": {
          "200": {
            "description": "OK"
          },
          "204": {
            "description": "Авторизация прекращена"
          },
          "400": {
            "description": "Ошибка авторизации"
          },
          "404": {
            "description": "Сотрудник не найден"
          }
        }
      }
    },
    "/api/log": {
      "post": {
        "tags": [
          "Log"
        ],
        "summary": "Добавить событие",
        "parameters": [
          {
            "name": "data",
            "in": "query",
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "logType",
            "in": "query",
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK"
          },
          "204": {
            "description": "Событие добавлено"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "DeviceDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "description": {
            "type": "string",
            "nullable": true
          },
          "unitId": {
            "type": "integer",
            "format": "int64"
          },
          "employeeId": {
            "type": "integer",
            "format": "int64"
          },
          "macAddress": {
            "type": "string",
            "nullable": true
          },
          "softwareVersion": {
            "type": "string",
            "nullable": true
          },
          "unsentFilesCount": {
            "type": "integer",
            "format": "int32"
          },
          "lastActivity": {
            "type": "string",
            "format": "date-time"
          },
          "isArchived": {
            "type": "boolean"
          },
          "isBlocked": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      },
      "EmployeeDto": {
        "required": [
          "firstname",
          "lastname",
          "position",
          "unitId"
        ],
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int64"
          },
          "number": {
            "type": "integer",
            "format": "int32"
          },
          "externalId": {
            "type": "string",
            "nullable": true
          },
          "lastname": {
            "minLength": 1,
            "type": "string"
          },
          "firstname": {
            "minLength": 1,
            "type": "string"
          },
          "fathername": {
            "type": "string",
            "nullable": true
          },
          "position": {
            "minLength": 1,
            "type": "string"
          },
          "unitId": {
            "maximum": 9223372036854776000,
            "minimum": 1,
            "type": "integer",
            "format": "int64"
          },
          "unitName": {
            "type": "string",
            "nullable": true
          },
          "isArchived": {
            "type": "boolean"
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "JWT Authorization header using the Bearer scheme. <br/>\n                      Enter 'Bearer' [space] and then your token in the text input below.\n                      <br/><br/> Example: 'Bearer 12345abcdef'",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}