{
  "openapi": "3.0.1",
  "info": {
    "title": "AsbCloudWebApi",
    "version": "1.0"
  },
  "paths": {
    "/auth/login": {
      "post": {
        "tags": [
          "Auth"
        ],
        "summary": "Аутентификация пользователя",
        "operationId": "Login",
        "requestBody": {
          "description": "",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/AuthDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/AuthDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "новый токен",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokenDto"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokenDto"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/UserTokenDto"
                }
              }
            }
          },
          "400": {
            "description": "логин и пароль не подходят"
          }
        }
      }
    },
    "/auth/refresh": {
      "get": {
        "tags": [
          "Auth"
        ],
        "summary": "Продление срока действия токена",
        "operationId": "Refresh",
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/well/{wellId}/data": {
      "get": {
        "tags": [
          "Data"
        ],
        "summary": "Возвращает данные САУБ по скважине.\r\nПо умолчанию за последние 10 минут.",
        "operationId": "Get",
        "parameters": [
          {
            "name": "wellId",
            "in": "path",
            "description": "id скважины",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "begin",
            "in": "query",
            "description": "дата начала выборки. По умолчанию: текущее время - intervalSec",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "intervalSec",
            "in": "query",
            "description": "интервал времени даты начала выборки, секунды",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 600
            }
          },
          {
            "name": "approxPointsCount",
            "in": "query",
            "description": "желаемое количество точек. Если в выборке точек будет больше, то выборка будет прорежена.",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 1024
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DataSaubBaseDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DataSaubBaseDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/DataSaubBaseDto"
                  }
                }
              }
            }
          }
        }
      }
    },
    "/api/well/{wellId}/message": {
      "get": {
        "tags": [
          "Message"
        ],
        "summary": "Выдает список сообщений по скважине",
        "operationId": "Get",
        "parameters": [
          {
            "name": "wellId",
            "in": "path",
            "description": "id скважины",
            "required": true,
            "schema": {
              "type": "integer",
              "format": "int32"
            }
          },
          {
            "name": "categoryids",
            "in": "query",
            "description": "список категорий",
            "schema": {
              "type": "array",
              "items": {
                "type": "integer",
                "format": "int32"
              }
            }
          },
          {
            "name": "begin",
            "in": "query",
            "description": "дата начала",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "end",
            "in": "query",
            "description": "окончание",
            "schema": {
              "type": "string",
              "format": "date-time"
            }
          },
          {
            "name": "skip",
            "in": "query",
            "description": "для пагинации кол-во записей пропустить",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 0
            }
          },
          {
            "name": "take",
            "in": "query",
            "description": "для пагинации кол-во записей",
            "schema": {
              "type": "integer",
              "format": "int32",
              "default": 32
            }
          }
        ],
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "$ref": "#/components/schemas/MessageDtoPaginationContainer"
                }
              },
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageDtoPaginationContainer"
                }
              },
              "text/json": {
                "schema": {
                  "$ref": "#/components/schemas/MessageDtoPaginationContainer"
                }
              }
            }
          }
        }
      }
    },
    "/api/telemetry/{uid}/info": {
      "post": {
        "tags": [
          "Telemetry"
        ],
        "summary": "Принимает общую информацию по скважине",
        "operationId": "Info",
        "parameters": [
          {
            "name": "uid",
            "in": "path",
            "description": "Уникальный идентификатор отправителя",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "нформация об отправителе",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/TelemetryInfoDto"
              }
            },
            "text/json": {
              "schema": {
                "$ref": "#/components/schemas/TelemetryInfoDto"
              }
            },
            "application/*+json": {
              "schema": {
                "$ref": "#/components/schemas/TelemetryInfoDto"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/telemetry/{uid}/data": {
      "post": {
        "tags": [
          "Telemetry"
        ],
        "summary": "Принимает данные от разных систем по скважине",
        "operationId": "Data",
        "parameters": [
          {
            "name": "uid",
            "in": "path",
            "description": "Уникальный идентификатор отправителя",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "Данные",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DataSaubBaseDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DataSaubBaseDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/DataSaubBaseDto"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/telemetry/{uid}/message": {
      "post": {
        "tags": [
          "Telemetry"
        ],
        "summary": "Принимает список новых сообщений от телеметрии",
        "operationId": "Message",
        "parameters": [
          {
            "name": "uid",
            "in": "path",
            "description": "Уникальный идентификатор отправителя",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "сообщения",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TelemetryMessageDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TelemetryMessageDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TelemetryMessageDto"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/telemetry/{uid}/event": {
      "post": {
        "tags": [
          "Telemetry"
        ],
        "summary": "Принимает справочник событий",
        "operationId": "Events",
        "parameters": [
          {
            "name": "uid",
            "in": "path",
            "description": "Уникальный идентификатор отправителя",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "справочник событий",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EventDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EventDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/EventDto"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/telemetry/{uid}/user": {
      "post": {
        "tags": [
          "Telemetry"
        ],
        "summary": "Принимает справочник пользователей телеметрии",
        "operationId": "Users",
        "parameters": [
          {
            "name": "uid",
            "in": "path",
            "description": "Уникальный идентификатор отправителя",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "description": "справочник пользователей телеметрии",
          "content": {
            "application/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TelemetryUserDto"
                }
              }
            },
            "text/json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TelemetryUserDto"
                }
              }
            },
            "application/*+json": {
              "schema": {
                "type": "array",
                "items": {
                  "$ref": "#/components/schemas/TelemetryUserDto"
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Success"
          }
        }
      }
    },
    "/api/well": {
      "get": {
        "tags": [
          "Well"
        ],
        "operationId": "Get",
        "responses": {
          "200": {
            "description": "Success",
            "content": {
              "text/plain": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WellDto"
                  }
                }
              },
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WellDto"
                  }
                }
              },
              "text/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/WellDto"
                  }
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "AuthDto": {
        "type": "object",
        "properties": {
          "login": {
            "type": "string",
            "nullable": true
          },
          "password": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "DataSaubBaseDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "mode": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "user": {
            "type": "string",
            "nullable": true
          },
          "wellDepth": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "bitDepth": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockPosition": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockPositionMin": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockPositionMax": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockSpeed": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockSpeedSp": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockSpeedSpRotor": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockSpeedSpSlide": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "blockSpeedSpDevelop": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressure": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressureIdle": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressureSp": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressureSpRotor": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressureSpSlide": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressureSpDevelop": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "pressureDeltaLimitMax": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "axialLoad": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "axialLoadSp": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "axialLoadLimitMax": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "hookWeight": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "hookWeightIdle": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "hookWeightLimitMin": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "hookWeightLimitMax": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "rotorTorque": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "rotorTorqueIdle": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "rotorTorqueSp": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "rotorTorqueLimitMax": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "rotorSpeed": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "flow": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "flowIdle": {
            "type": "number",
            "format": "double",
            "nullable": true
          },
          "flowDeltaLimitMax": {
            "type": "number",
            "format": "double",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "EventDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "message": {
            "type": "string",
            "nullable": true
          },
          "idCategory": {
            "type": "integer",
            "format": "int32"
          },
          "tag": {
            "type": "string",
            "nullable": true
          },
          "eventType": {
            "type": "integer",
            "format": "int32"
          },
          "idSound": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "MessageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "categoryId": {
            "type": "integer",
            "format": "int32"
          },
          "user": {
            "type": "string",
            "nullable": true
          },
          "message": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "MessageDtoPaginationContainer": {
        "type": "object",
        "properties": {
          "skip": {
            "type": "integer",
            "format": "int32"
          },
          "take": {
            "type": "integer",
            "format": "int32"
          },
          "count": {
            "type": "integer",
            "format": "int32"
          },
          "items": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MessageDto"
            },
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TelemetryInfoDto": {
        "type": "object",
        "properties": {
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "timeZoneId": {
            "type": "string",
            "nullable": true
          },
          "timeZoneOffsetTotalHours": {
            "type": "number",
            "format": "double"
          },
          "caption": {
            "type": "string",
            "nullable": true
          },
          "cluster": {
            "type": "string",
            "nullable": true
          },
          "deposit": {
            "type": "string",
            "nullable": true
          },
          "hmiVersion": {
            "type": "string",
            "nullable": true
          },
          "plcVersion": {
            "type": "string",
            "nullable": true
          },
          "comment": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TelemetryMessageDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "date": {
            "type": "string",
            "format": "date-time"
          },
          "idEvent": {
            "type": "integer",
            "format": "int32"
          },
          "state": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "idTelemetryUser": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "arg0": {
            "type": "string",
            "nullable": true
          },
          "arg1": {
            "type": "string",
            "nullable": true
          },
          "arg2": {
            "type": "string",
            "nullable": true
          },
          "arg3": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "TelemetryUserDto": {
        "type": "object",
        "properties": {
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "surname": {
            "type": "string",
            "nullable": true
          },
          "patronymic": {
            "type": "string",
            "nullable": true
          },
          "level": {
            "type": "integer",
            "format": "int32"
          }
        },
        "additionalProperties": false
      },
      "UserTokenDto": {
        "type": "object",
        "properties": {
          "login": {
            "type": "string",
            "nullable": true
          },
          "level": {
            "type": "integer",
            "format": "int32",
            "nullable": true
          },
          "name": {
            "type": "string",
            "nullable": true
          },
          "surname": {
            "type": "string",
            "nullable": true
          },
          "patronymic": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "customerName": {
            "type": "string",
            "nullable": true
          },
          "roleName": {
            "type": "string",
            "nullable": true
          },
          "token": {
            "type": "string",
            "nullable": true
          }
        },
        "additionalProperties": false
      },
      "WellDto": {
        "type": "object",
        "properties": {
          "caption": {
            "type": "string",
            "nullable": true
          },
          "cluster": {
            "type": "string",
            "nullable": true
          },
          "deposit": {
            "type": "string",
            "nullable": true
          },
          "id": {
            "type": "integer",
            "format": "int32"
          },
          "lastData": {
            "nullable": true
          }
        },
        "additionalProperties": false
      }
    },
    "securitySchemes": {
      "Bearer": {
        "type": "apiKey",
        "description": "JWT Authorization header using the Bearer scheme. Enter 'Bearer' [space] and then your token in the text input below. Example: 'Bearer 12345abcdef'",
        "name": "Authorization",
        "in": "header"
      }
    }
  },
  "security": [
    {
      "Bearer": [ ]
    }
  ]
}