openapi: "3.0.2"
info:
  title: "Система оповещения персонала"
  description: ""
  version: "0.1"
  contact:
    name: "Диспетчерская связь"
servers:
- url: "http://192.168.15.70:9000"
  description: Local server1
- url: "http://127.0.0.1:9000"
  description: Local server2


paths:
  /api/v1/status:
    get:
      tags:
        - Статус
      summary: Статус сервера SIP телефонии
      operationId: DomainList
      parameters:
          - $ref: '#/components/parameters/cmd'
      responses:
        200:
          content:
            application/json: {}
            application/xml: {}
          description: Successful response
          
  /api/v1/session:
    get:
      tags:
        - Сессия
      summary: Cписок текущих сессий
      operationId: SessionList
      responses:
        200:
          description: Successful response
    post:
      tags:
        - Сессия
      summary: Создать новую сессию
      operationId: CreateSession
      responses:
        200:
          description: Successful response

  /api/v1/session/{session_id}:
    get:
      tags:
        - Сессия
      summary: Состояние сессии
      operationId: SessionState
      parameters:
        - $ref: '#/components/parameters/session_id'
      responses:
        200:
          description: Successful response
    put:
      tags:
        - Сессия
      summary: Изменить данные сессии
      operationId: UpdateSession
      parameters:
        - $ref: '#/components/parameters/session_id'
      responses:
        200:
          description: Successful response
    delete:
      tags:
        - Сессия
      summary: Закрыть сессию
      operationId: DeleteSession
      parameters:
        - $ref: '#/components/parameters/session_id'
      responses:
        200:
          description: Successful response

  /api/v1/call:
    get:
      tags:
        - Вызов
      summary: Список текущих вызовов
      operationId: CallList
      responses:
        200:
          description: Successful response
    post:
      tags:
        - Вызов
      summary: Создать вызов
      operationId: CreateCall
      responses:
        200:
          description: Successful response

  /api/v1/call/{call_id}:
    get:
      tags:
        - Вызов
      summary: Статус текущего вызова
      operationId: StatusCall
      parameters:
        - $ref: '#/components/parameters/call_id'
      responses:
        200:
          description: Successful response
    delete:
      tags:
        - Вызов
      summary: Остановить текущий вызов
      operationId: CanselCall
      parameters:
        - $ref: '#/components/parameters/call_id'
      responses:
        200:
          description: Successful response

          
  /api/v1/config:
    get:
      tags:
        - Настройки
      summary: Список параметров приложения
      operationId: ConfigList
      responses:
        200:
          description: Successful response
    put:
      tags:
        - Настройки
      summary: Изменить параметры приложения
      operationId: UpdateConfig
      responses:
        200:
          description: Successful response
          
  # /{context_id}/ext/{ext_id}:
  #   get:
  #     tags:
  #       - Управление вызовом
  #     summary: Правила для extension
  #     operationId: Ext
  #     parameters:
  #       - $ref: '#/components/parameters/context_id'
  #       - $ref: '#/components/parameters/ext_id'
  #     responses:
  #       200:
  #         description: Successful response
                
  # /{domain_id}/users:
  #   get:
  #     tags:
  #       - Абоненты
  #     summary: Cписок абонентов домена domain_id
  #     operationId: GetSubs
  #     parameters:
  #       - $ref: '#/components/parameters/domain_id'
  #     responses:
  #       200:
  #         description: Successful response
  # /{domain_id}/user/{user_id}:
  #   get:
  #     tags:
  #       - Абоненты
  #     summary: Параметры абонента
  #     operationId: GetSub
  #     parameters:
  #       - $ref: '#/components/parameters/domain_id'
  #       - $ref: '#/components/parameters/user_id'
  #     responses:
  #       200:
  #         description: Successful response
  # /{domain_id}/user:
  #   post:
  #     tags:
  #       - Абоненты
  #     summary: Добавить абонента
  #     operationId: CreateSub
  #     parameters:
  #       - $ref: '#/components/parameters/domain_id'
  #     requestBody:
  #       description: "Json для добавления абонента"
  #       required: true
  #       content:
  #         application/json:
  #           schema:
  #             type: object
  #             example:
  #               user_id: '2217'
  #               pass: '2217'
  #               vars:
  #                 user_context: 'default'
  #                 effective_caller_id_name: '2217'
  #     responses:
  #       200:
  #         description: 
  #           Successful response
  
  # /profiles:
  #   get:
  #     tags:
  #       - SIP профили
  #     summary: Список профилей
  #     operationId: GetPriles
  #     responses:
  #       200:
  #         description: Successful response

  # /profile/{profile_id}:
  #   get:
  #     tags:
  #       - SIP профили
  #     summary: Праметры профиля
  #     operationId: GetPrile
  #     parameters:
  #       - $ref: '#/components/parameters/profile_id'
  #     responses:
  #       200:
  #         description: Successful response

  # /vars:
  #   get:
  #     tags:
  #       - Other
  #     summary: Список переменных
  #     operationId: GetVars
  #     responses:
  #       200:
  #         description: Successful response
          
 
components:
  parameters:
    id:
      name: id
      in: path
      required: true
      description: "Id абонента"
      schema:
        type: integer
    user_id:
      name: user_id
      in: path
      required: true
      description: "Id абонента"
      schema:
        type: integer
      examples:
        defaultUser:
          summary: default абонент
          value: 2217
    domain_id:
      name: domain_id
      in: path
      required: true
      description: "Id домена"
      schema:
        type: string
      examples:
        defaultExample:
          summary: default домен
          value: default
    cmd:
      name: cmd
      in: query
      required: false
      description: "Команда API Freeswitch"
      schema:
        type: string
      examples:
        defaultExample:
          summary: статус freeswitch
          value: status
    ext_id:
      name: ext_id
      in: path
      required: true
      description: "extensin Id"
      schema:
        type: string
    session_id:
      name: session_id
      in: path
      required: true
      description: "имя сессии"
      schema:
        type: string
    call_id:
      name: call_id
      in: path
      required: true
      description: "id вызова"
      schema:
        type: string
    profile_id:
      name: profile_id
      in: path
      required: true
      description: "Profile Id"
      schema:
        type: string
      examples:
        internalExample:
          summary: internal профиль
          value: internal
        externalExample:
          summary: external профиль
          value: public
    user_body:
      name: body
      in: query
      required: true
      description: "User body"
      schema:
        type: object
        properties:
          user_id:
            type: string
            example: '2217'
          pass:
            type: string
            example: '2217'
          vars:
            type: object
            properties:
              user_context:
                type: string
                example: 'default'
        
  schemas:
    DomainList:
      title: Список доменов
      type: array
      items:
        $ref: '#/components/schemas/Domain'
    Domain:
      title: Домен
      type: object
      properties:
        id:
          $ref: '#/components/schemas/Id'
        users:
          $ref: '#/components/schemas/Users'
        links:
          $ref: '#/components/schemas/Dom'
    NewUser:
      title: НовыйАбонент
      type: object
      properties:
        depart:
          $ref: '#/components/schemas/Depart'
        f_name:
          $ref: '#/components/schemas/Fname'
        l_name:
          $ref: '#/components/schemas/L_name'
        name:
          $ref: '#/components/schemas/Name'
        role:
          $ref: '#/components/schemas/Role'
        phones:
          $ref: '#/components/schemas/Phones'
        tags:
          $ref: '#/components/schemas/Tags'
    Users:
      type: string
      description: Сcылка на список абонентов домена
      format: uri
      example: http://uri/domain/users
    Dom:
      type: string
      description: Сcылка на данные домена
      format: uri
      example: http://uri/domain/default
      
    Depart:
      type: integer
      description: Номер подразделения
      format: int32
      example: 2092171502
    Fname:
      type: string
      description: Фамилия
      example: Макаревич
    L_name:
      type: string
      description: Отчество
      example: Александрович
    Name:
      type: string
      description: Имя
      example: Михаил
    Id:
      type: string
      description: Идентификатор ресурса
      format: string
      example: default
    Role:
      type: string
      description: Должность
      example: иженер
    Phones:
      type: array
      description: Список телефонов
      items:
        title: Phone
        type: string
        description: Номер телефона
        example: +375xxxxxxxxx
    Tags:
      type: array
      description: Список групп вызова
      items:
        title: GroupName
        type: integer
        description: Группа вызова
        format: int32
        example: 123
                    
