openapi: 3.0.0
info:
  version: 1.3-oas3
  title: Dateilor Web API
  description: "Текущая документация описывает правила доступа.<br/><br/>
  Весь обмен данными происходит в формате `JSON`, поэтому обязательны следующие заголовки `Accept: application/json` и `Content-Type: application/json`.<br/><br/>
  Каждый последующий запрос должен содержать заголовок `Authorization: Bearer {token}` для авторизации запроса.<br/><br/>"

servers:
  - url: https://deks-api.fairtech-marketing.com/api/
    description: Develop Test server

security:
  - Bearer: []

components:
  securitySchemes:
    Bearer:
      type: http
      description: API токен который Вы можете сгенерировать выполнив запрос login (первый в списке)
      scheme: bearer
  parameters:
    page:
      name: page
      description: "Номер страницы. Одна страница содержит 100 записей "
      required: false
      in: query
      schema:
        type: integer
        example: 1
    token:
      name: token
      description: "token"
      required: true
      in: path
      schema:
        type: string
        example: ''
    orderPath:
      name: order
      description: "id заказа"
      required: true
      in: path
      schema:
        type: integer
        example: 1
    materialPath:
      name: material
      description: "id материала в системе заказа"
      required: true
      in: path
      schema:
        type: integer
        example: 1
    detailPath:
      name: detail
      description: "id детали"
      required: true
      in: path
      schema:
        type: integer
        example: 1
    carvePath:
      name: carve
      description: "id обработки"
      required: true
      in: path
      schema:
        type: integer
        example: 1
    materialTypeQuery:
      name: type
      description: >
        Тип материала заказа. 
        Список значений через запятую.
        Возможные варианты "plate", "tabletop", "edge", "furniture", "facade"
      required: false
      in: query
      schema:
        type: string
        example: "plate"
  responses:
    200:
      description: Успешный ответ.
      content:
        application/json:
          schema:
            title: Success
            type: object
            properties:
              status:
                $ref: "#/components/schemas/status"
              message:
                $ref: "#/components/schemas/message"
              data:
                $ref: "#/components/schemas/content"
    400:
      description: Bad request
      content:
        application/json:
          schema:
            title: Sample
            type: object
            properties:
              status:
                allOf:
                  - $ref: "#/components/schemas/status"
                  - example: error
              message:
                allOf:
                  - $ref: "#/components/schemas/message"
                  - example: 'Some data wrong'
              content:
                type: array
                items:
                  type: object
                  properties:
                    message:
                      type: string
                      example: "not imported"
                    data:
                      type: object
                    errors:
                      type: object
                    # $ref: "#/components/schemas/content"
    401:
      description: Unauthenticated. Может произойти при использовании неверного или просроченного токена.
      content:
        application/json:
          schema:
            title: Sample
            type: object
            properties:
              status:
                allOf:
                  - $ref: "#/components/schemas/status"
                  - example: error
              message:
                allOf:
                  - $ref: "#/components/schemas/message"
                  - example: 'Unauthenticated'
              content:
                allOf:
                  - $ref: "#/components/schemas/content"



  schemas:
    status:
      type: string
      description: Флаг выполнения запроса
      enum: [success, error]
    message:
      type: string
      description: Вспомогательное сообщение
      example: "Success"
    content:
      type: object
      description: Полезное содержимое ответа
#    ContentSummary:
#      type: object
#      properties:
#        total_records:
#          type: integer
#          description: Bcего записей
#          example: 2
#        current_page:
#          type: integer
#          description: Номер текущей старницы
#          example: 1
#        per_page:
#          type: integer
#          description: Количество записей на страницах
#          example: 100
#        page_records:
#          type: integer
#          description: Количество записей на текущей странице
#          example: 2
#        total_pages:
#          type: integer
#          description: Всего страниц доступно
#          example: 1
#      required:
#        - total_records
#        - current_page
#        - per_page
#        - page_records
#        - total_pages
    Edge:
      description: "Кромка детали"
      type: object
      properties:
        id:
          type: integer
          description: "id кромки в системе заказа"
          example: 125
        detail_id:
          type: integer
          description: >
            id детали к которой привязана кромка
          example: 54
        material_id:
          type: integer
          description: >
            id материала кромки в системе заказа
          example: 1256
        plate_id:
          type: integer
          description: >
            id материала плиты в системе заказа
          example: 1255
        type_edge:
          type: string
          description: "Маркер указывающий положение кромки на детали"
          example: "end_top"
    Carve:
      description: "Обработка детали"
      type: object
      properties:
        id:
          type: integer
          description: "id обработки в системе заказа"
          example: 125
        order_detail_id:
          type: integer
          description: >
            id детали к которой привязана обработка
          example: 54
        template_id:
          type: integer
          description: >
            id шаблона обработки
          example: 1256
        valid:
          type: boolean
          description: >
            Флаг валидности обработки
          example: true
        params:
          type: object
          description: "Набор параметров индивидуален для каждой операции"
          example: "{}"
    Tool:
      description: "Инструмент обработки детали"
      type: object
      properties:
        id:
          type: integer
          description: "id инструмента"
          example: 125
        code:
          type: string
          description: "Код инструмента в реестре заказчика"
          example: "5N"
        type:
          type: string
          description: "Тип инструмента в реестре заказчика"
          example: "NORMALE"
        type_apply:
          type: string
          description: "Тип инструмента по месту применения"
          example: "bore_blind_side"
        diameter:
          type: number
          description: "Диаметр инструмента, если актуален, иначе 0"
          example: 5
        deep:
          type: number
          description: "Глубина примененеия инструмента, если актуально, иначе 0"
          example: 24
        thickness:
          type: number
          description: "Толщина инструмента, если актуально, иначе 0"
          example: 0
        is_bore:
          type: boolean
          description: "Флаг что это бур"
          example: true
        is_bore_blind:
          type: boolean
          description: "Флаг что это бур для глухого бурения"
          example: true
        is_bore_through:
          type: boolean
          description: "Флаг что это бур для сквозного бурения"
          example: false
        is_saw:
          type: boolean
          description: "Флаг что это пила"
          example: false
        is_mill:
          type: boolean
          description: "Флаг что это фреза"
          example: false
        is_target_side:
          type: boolean
          description: "Флаг применения инструмента в плоскость детали"
          example: true
        is_target_edge:
          type: boolean
          description: "Флаг применения инструмента в торец детали"
          example: false
    Detail:
      description: "Деталь"
      type: object
      properties:
        id:
          type: integer
          description: "id детали в системе заказа"
          example: 125
        order_id:
          type: integer
          description: >
            id заказа
          example: 54
        material_id:
          type: integer
          description: >
            id материала в системе заказа
          example: 54
        position:
          type: integer
          description: >
            Статический порядковый номер детали.
            Присваивается при создании и никогда не меняется.
          example: 1
        name:
          type: string
          description: "Название детали"
          example: 54
        price:
          type: number
          description: "Цена детали"
          example: 54.25
        width:
          type: integer
          description: "Ширина детали"
          example: 100
        length:
          type: integer
          description: "Длина детали"
          example: 100
        height:
          type: integer
          description: "Пока не используется"
          example: 100
        thickness:
          type: integer
          description: "Количество слоев: 1,2,3"
          example: 1
        is_texture_set:
          type: boolean
          description: "Ориентация по тестуре"
          example: false
        is_milling:
          type: boolean
          description: "Наличие обработок фрезерование"
          example: false
        is_grooves:
          type: boolean
          description: "Наличие обработок пазование"
          example: false
        is_hole_additive:
          type: boolean
          description: "Наличие обработок сверление"
          example: false
        index_no:
          type: integer
          description: "Не определено"
          example: 0
        order_no:
          type: integer
          description: "Позиция сортировки"
          example: false
        has_invalid_carves:
          type: boolean
          description: "Флаг наличия невалидных операций"
          example: false
        edges:
          type: array
          description: >
            Список кромок у детали.
          items:
            $ref: '#/components/schemas/Edge'
    Operation:
      description: "Операци"
      type: object
      properties:
        id:
          type: integer
          description: "id операции"
          example: 125
        order_id:
          type: integer
          description: "id заказа"
          example: 54
        name:
          type: string
          description: "Название операции"
          example: "cutting"
        code:
          type: string
          description: "Код операции"
          example: "cutting"
        measure:
          type: string
          description: "Единица измерения операции"
          example: "м/п"
        value:
          type: number
          description: "Количество"
          example: 305.68
        price:
          type: number
          description: "Цена операции за ед.изм"
          example: 10.0
        total:
          type: number
          description: "Стоимость операции"
          example: 3056.8
    Material:
      description: "Материал заказа"
      type: object
      properties:
        id:
          type: integer
          description: "id материала в системе заказа"
          example: 125
        order_id:
          type: integer
          description: "id заказа"
          example: 54
        product_id:
          type: integer
          description: "id материала в системе товаров"
          example: 54
        type:
          type: string
          description: "Тип материала"
          example: "plate"
        article:
          type: string
          description: "Артикул"
          example: "30568"
        name:
          type: string
          description: "Название материала"
          example: "Плита ..."
        price:
          type: number
          description: "Цена материала"
          example: 25.56
        total_price:
          type: number
          description: "Стоимость материала по количеству quantity"
          example: 25.56
        quantity:
          type: integer
          description: "Количество материала в заказе"
          example: 25
        min_quantity:
          type: integer
          description: >
            Мин Количество материала в заказе. Менеджер не может изменить количество в заказе меньше этого значения
            Заполняется по результатам порезки
          example: 25.56
        width:
          type: number
          description: "Ширина"
          example: 25.56
        height:
          type: number
          description: "Длина/Высота"
          example: 25.56
        thickness:
          type: number
          description: "Толщина"
          example: 25.56
        details_count:
          type: integer
          description: "Количество деталей"
          example: 25
        index_no:
          type: integer
          description: "Не определено"
          example: 0
        order_no:
          type: integer
          description: "Позиция сортировки"
          example: false
        with_waste:
          type: boolean
          description: "Флаг Отгружать остатки"
          example: false
        edge_line:
          type: integer
          description: "Id кромки в системе заказа, которая установлена как кромка по умолчанию для плиты"
          example: 1238
        image:
          type: string
          description: "Url картинки материала"
          example: 1238
        color:
          type: string
          description: "Код цвета для кромки"
          example: "#3EE2F1"
        thickness_changeable:
          type: boolean
          description: "Флаг возможности склейки данного материала"
          example: false
    CalculationMaterial:
      description: "Материал(товар) заказа учавствующий в калькуляции"
      type: object
      properties:
        id:
          type: integer
          description: "id материала в системе заказа"
          example: 125
        type:
          type: string
          description: "Тип материала"
          example: "plate"
        article:
          type: string
          description: "Артикул"
          example: "30568"
        name:
          type: string
          description: "Название материала"
          example: "Плита ..."
        price:
          type: number
          description: "Цена материала"
          example: 25.56
        total:
          type: number
          description: "Стоимость материала по количеству quantity"
          example: 25.56
        quantity:
          type: integer
          description: "Количество материала в заказе"
          example: 25
        order_no:
          type: integer
          description: "Позиция сортировки"
          example: false
        color:
          type: string
          description: "Код цвета для кромки"
          example: "#3EE2F1"


paths:
  /auth/login:
    post:
      security: []
      tags:
        - Авторизация
      summary: "Авторизация (получение токена)"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                phone:
                  type: string
                  example: "380123456789"
                password:
                  type: string
                  example: "password"
      responses:
        200:
          description: "Успешное получение токена"
          content:
            application/json:
              schema:
                title: Sample
                type: object
                properties:
                  status:
                    $ref: "#/components/schemas/status"
                  message:
                    type: string
                    description: "Вспомогательное сообщение"
                    example: "New token created"
                  content:
                    type: object
                    properties:
                      access_token:
                        type: string
                        example: "2|WHEwLgpLT1lGBfIMXgkya7n4uV2XlUE7AAJLTQvI"
                      token_type:
                        type: string
                        example: "Bearer"
  /create:
    post:
      security: [ ]
      tags:
        - Работа с заказами
      summary: "Создание заказа"
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                id_site:
                  type: integer
                  description: id товара в БД сайта
                  example: 123
                quantity:
                  type: integer
                  description: количество товаров
                  example: 5
                user_id_site:
                  type: integer
                  description: id пользователя в БД сайта
                  example: 71
      responses:
        200:
          description: "Детали заказа"
          content:
            application/json:
              schema:
                title: Sample
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      order_id:
                        type: integer
                        description: "id заказа на сайте"
                        example: 354551
                      product:
                        type: object
                        description: "детали товара"


  /auth/token/{token}:
    get:
      security: [ ]
      tags:
        - Авторизация
      summary: "Авторизация (проверка токена)"
      parameters:
        - $ref: '#/components/parameters/token'
      responses:
        200:
          description: "Токен подтвержден"
          content:
            application/json:
              schema:
                title: Sample
                type: object
                properties:
                  status:
                    $ref: "#/components/schemas/status"
                  message:
                    type: string
                    description: "Вспомогательное сообщение"
                    example: "Токен подтвержден"
        403:
          description: "Токен не подтвержден"
          content:
            application/json:
              schema:
                title: Sample
                type: object
                properties:
                  status:
                    $ref: "#/components/schemas/status"
                  message:
                    type: string
                    description: "Вспомогательное сообщение"
                    example: "Токен не подтвержден"


  /order/{order}:
    get:
      security: [ ]
      tags:
        - Работа с заказами
      summary: "Получение деталей по заказу"
      parameters:
        - $ref: '#/components/parameters/orderPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                        id:
                          type: integer
                          description: "id заказа на сайте"
                          example: 354551
                        id_1c:
                          type: string
                          description: "id заказа в 1C"
                          example: "1c354551"
                        id_external:
                          type: string
                          description: "id внешний"
                          example: "ex354551"
                        customer_id:
                          type: integer
                          description: "id пользователя"
                          example: 71
                        product_id:
                          type: integer
                          description: "id товара"
                          example: 1234
                        production_id:
                          type: integer
                          description: "id производства"
                          example: 12
                        product_id_cut_map:
                          type: integer
                          description: "id карты порезки"
                          example: 5
                        name:
                          type: string
                          description: "Название"
                          example: ""
                        total_price:
                          type: number
                          description: "Итоговая стоимость заказа"
                          example: 100.00
                        total_products_price:
                          type: array
                          description: "Итоговая стоимость материалов в заказе"
                          example: 100.00
                        note:
                          type: string
                          description: "Коментарий"
                          example: ""
                        status:
                          type: string
                          description: "Статус заказа"
                          example: ''
                        delivery_service:
                          type: string
                          description: "Адрес доставки"
                          example: ''
                        ttn:
                          type: string
                          description: "ТТН"
                          example: "1354551"
                        invoice_url:
                          type: string
                          description: "Url cчета"
                          example: ""
                        created_at:
                          type: string
                          description: "Дата создания"
                          example: "2023-09-04 11:24:07"
                        updated_at:
                          type: string
                          description: "Дата обновления"
                          example: "2023-09-05 12:36:07"
                        processed_at:
                          type: string
                          description: "Дата обработки"
                          example: "2023-09-05 12:36:07"
                        paid_at:
                          type: string
                          description: "Дата оплаты"
                          example: "2023-09-05 12:36:07"
                        ready_to_dispatch_at:
                          type: string
                          description: "Дата готовности к отправке"
                          example: "2023-09-05 12:36:07"
                        dispatched_at:
                          type: string
                          description: "Дата отправки"
                          example: "2023-09-05 12:36:07"
                        delivered_at:
                          type: string
                          description: "Дата доставки"
                          example: "2023-09-05 12:36:07"
                        completed_at:
                          type: string
                          description: "Дата завершения"
                          example: "2023-09-05 12:36:07"
                        is_active:
                          type: boolean
                          description: "Актиный заказ ?"
                          example: "1"
                        is_cut_map:
                          type: boolean
                          description: "Наличие карты порезки"
                          example: "1"
                        shipping_method:
                          type: string
                          description: "Метод доставки"
                          example: ""
                        shipping_type:
                          type: string
                          description: "Тип доставки"
                          example: ""
                        shipping_city:
                          type: string
                          description: "Город доставки"
                          example: ""
                        shipping_city_id:
                          type: integer
                          description: "Id города доставки"
                          example: ""
                        shipping_otdel:
                          type: string
                          description: "Отделение доставки"
                          example: ""
                        shipping_otdel_id:
                          type: integer
                          description: "Id отделения доставки"
                          example: ""
                        shipping_address:
                          type: string
                          description: "Адресс доставки"
                          example: ""
                        shipping_region:
                          type: string
                          description: "Регион доставки"
                          example: ""
                        shipping_region_id:
                          type: integer
                          description: "Id региона доставки"
                          example: ""
                        shipping_fio:
                          type: string
                          description: "ФИО"
                          example: ""
                        shipping_phone:
                          type: string
                          description: "Номер телефона"
                          example: ""
                        shipping_date:
                          type: string
                          description: "Дата доставки"
                          example: ""
                        shipping_comment:
                          type: string
                          description: "Комментарий"
                          example: ""
                        customer_name:
                          type: string
                          description: "Имя покупателя"
                          example: ""
                        customer_phone:
                          type: string
                          description: "Номер телефона покупателя"
                          example: ""
                        customer_email:
                          type: string
                          description: "Email покупателя"
                          example: ""
                        products:
                          type: array
                          items:
                            $ref: '#/components/schemas/Material'

  /order/{order}/calculations:
    get:
      security: []
      tags:
        - Работа с заказами
      summary: "Получение калькуляции по заказу"
      parameters:
        - $ref: '#/components/parameters/orderPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      total:
                          type: number
                          description: "Итоговая стоимость заказа"
                          example: []
                      total_products:
                          type: array
                          description: "Итоговая стоимость материалов в заказе"
                          example: []
                      total_operations:
                          type: array
                          description: "Итоговая стоимость операций в заказе"
                          example: []
                      products:
                        type: array
                        items:
                            $ref: '#/components/schemas/CalculationMaterial'
                      operation:
                        type: array
                        items:
                            $ref: '#/components/schemas/Operation'




  /order/{order}/cutting/furnitureOperations:
    get:
      security: []
      tags:
        - Работа с заказами
      summary: "Получение списка операций для подбора фурнитуры"
      parameters:
        - $ref: '#/components/parameters/orderPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      template:
                          type: string
                          description: "Код шаблона обработки"
                          example: "radius_inner"
                      title:
                          type: string
                          description: "Название обработки для списка подбора фурнитуры"
                          example: "Внутренний радиус"
                      filter_group:
                          type: string
                          description: "Название группы товаров для обработки"
                          example: "carve_led"
                      total:
                          type: number
                          description: "Количество в ед.изм. обработки"
                          example: 23.5




  /order/{order}/material:
    get:
      security: []
      tags:
        - Работа с материалами заказа
      summary: "Получение списка материалов заказа"
      parameters:
        - $ref: '#/components/parameters/orderPath'
        - $ref: '#/components/parameters/materialTypeQuery'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: object
                    properties:
                      plates:
                        type: array
                        description: "Массив обьектов Плита"
                        example: []
                      tabletops:
                        type: array
                        description: "Массив обьектов Столешница"
                        example: []
                      edges:
                        type: array
                        description: "Массив обьектов Кромка"
                        example: []
                      furniture:
                        type: array
                        description: "Массив обьектов Фурнитура"
                        example: []
                      facade:
                        type: array
                        description: "Массив обьектов Фасад"
                        example: []




  /order/{order}/material/{material}:
    post:
      security: []
      tags:
        - Работа с материалами заказа
      summary: "Добавление материала к заказу"
      parameters:
        - $ref: '#/components/parameters/orderPath'
        - $ref: '#/components/parameters/materialPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                template:
                  type: string
                  description: "Ключ шаблона операции (необязателен)"
                  example: "carve_led_direct"
                quantity:
                  type: integer
                  description: "Обновление количества"
                  example: 5
      responses:
        200:
          $ref: '#/components/responses/200'
    put:
      security: []
      tags:
        - Работа с материалами заказа
      summary: "Измененние данных по материалу"
      parameters:
        - $ref: '#/components/parameters/orderPath'
        - $ref: '#/components/parameters/materialPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                with_waste:
                  type: boolean
                  description: "Флаг `забрать остатки`"
                  example: true
                quantity:
                  type: integer
                  description: "Обновление количества"
                  example: 5
                edge_line:
                  type: integer
                  description: "Идентификатор материала кромки используемой по умолчанию 
                  (поле id элемента получаемого по `GET:/order/{order}/material`)"
                  example: 25
      responses:
        200:
          $ref: '#/components/responses/200'




  /material/{material}/cutting:
    get:
      security: []
      tags:
        - Работа с материалами заказа
      summary: "Получение результатов порезки по материалу"
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: object
                    properties:
                      edges:
                        type: array
                        description: "Массив обьектов Кромка"
                        items:
                          $ref: '#/components/schemas/Material'




  /material/{material}/detail:
    get:
      security: []
      tags:
        - Работа с деталями
      summary: "Получение списка деталей по материалу"
      parameters:
        - $ref: '#/components/parameters/materialPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/Detail'
    post:
      security: []
      tags:
        - Работа с деталями
      summary: "Создание новой детали"
      parameters:
        - $ref: '#/components/parameters/materialPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/Detail'




  /material/{material}/detail/bulk:
    post:
      security: []
      tags:
        - Работа с деталями
      summary: "Массовая правка деталей"
      parameters:
        - $ref: '#/components/parameters/materialPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                is_texture_set:
                  type: boolean
                  description: "Направление по тектуре"
                  example: true
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    type: array
                    example: []



  /detail/{detail}:
    get:
      security: []
      tags:
        - Работа с деталями
      summary: "Получение информации o детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/Detail'
    put:
      security: []
      tags:
        - Работа с деталями
      summary: "Изменение информации o детали"
      description: >
        Каждый параметр `тела запроса` является необязательным и может быть опущен.
      parameters:
        - $ref: '#/components/parameters/detailPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: "Название"
                  example: "Name 1"
                width:
                  type: integer
                  description: "Ширина"
                  example: 1
                length:
                  type: integer
                  description: "Ширина"
                  example: 1
                thickness:
                  type: integer
                  description: "Количество слоев: 1,2,3"
                  example: 1
                quantity:
                  type: integer
                  description: "количество"
                  example: 1
                is_texture_set:
                  type: boolean
                  description: "Ориентация по текстуре"
                  example: true
                order_no:
                  type: integer
                  description: "Установить порядок сортировки"
                  example: 1
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/Detail'
    delete:
      security: []
      tags:
        - Работа с деталями
      summary: "Удаление детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      responses:
        200:
          $ref: '#/components/responses/200'




  /detail/{detail}/replicate:
    post:
      security: []
      tags:
        - Работа с деталями
      summary: "Создание дубликата детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  status:
                    type: string
                    example: success
                  message:
                    type: string
                  data:
                    $ref: '#/components/schemas/Detail'




  /detail/{detail}/edge:
    get:
      security: []
      tags:
        - Работа с кромками детали
      summary: "Получение Материала кромки для детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: object
                    properties:
                      status:
                        type: string
                        example: success
                      message:
                        type: string
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Edge'


    post:
      security: []
      tags:
        - Работа с кромками детали
      summary: "Измененние Материала кромки для детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                type_edge:
                  type: string
                  description: Сторона применения кромки, один из (end_top, end_bottom, end_right, end_left)
                  example: "end_top"
                material_id:
                  type: integer
                  description: Идентификатор материала заказа (поле id элемента получаемого по `GET:/order/{order}/material`)
                  example: 1282
      responses:
        200:
          $ref: '#/components/responses/200'

    delete:
      security: []
      tags:
        - Работа с кромками детали
      summary: "Удаление материала кромки для детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                type_edge:
                  type: string
                  description: Тип кромки один из (end_top, end_bottom, end_right, end_left)
                  example: "end_top"
      responses:
        200:
          $ref: '#/components/responses/200'




  /order/detail/{detail}/carve:
    get:
      security: []
      tags:
        - Работа с обработками детали
      summary: "Получение всех обработок детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: object
                    properties:
                      status:
                        type: string
                        example: success
                      message:
                        type: string
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Carve'
    post:
      security: []
      tags:
        - Работа с обработками детали
      summary: "Создание обработки для детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                example: {}
                template:
                  type: string
                  description: Слаг шаблона
                  example: "template_slug"
                any_property:
                  type: string
                  description: Набор других индивидуальных параметров шаблона
                  example: property_value
      responses:
        200:
          $ref: '#/components/responses/200'

  /order/detail/{detail}/carve/{carve}:
    get:
      security: []
      tags:
        - Работа с обработками детали
      summary: "Получение определенной обработки детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
        - $ref: '#/components/parameters/carvePath'
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: object
                    properties:
                      status:
                        type: string
                        example: success
                      message:
                        type: string
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Carve'
    put:
      security: []
      tags:
        - Работа с обработками детали
      summary: "Обновление обработки детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
        - $ref: '#/components/parameters/carvePath'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                example: {}
                template:
                  type: string
                  description: Слаг шаблона
                  example: "template_slug"
                any_property:
                  type: string
                  description: Набор других индивидуальных параметров шаблона
                  example: property_value
      responses:
        200:
          $ref: '#/components/responses/200'
    delete:
      security: []
      tags:
        - Работа с обработками детали
      summary: "Удаление обработки детали"
      parameters:
        - $ref: '#/components/parameters/detailPath'
        - $ref: '#/components/parameters/carvePath'
      responses:
        200:
          $ref: '#/components/responses/200'




  /tools:
    get:
      security: []
      tags:
        - Разное
      summary: "Получение списка инструментов для обработки деталей"
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: object
                    properties:
                      status:
                        type: string
                        example: success
                      message:
                        type: string
                      data:
                        type: array
                        items:
                          $ref: '#/components/schemas/Tool'

  /productFilter:
    get:
      security: []
      tags:
        - Разное
      summary: "Получение списка товаров. Работа с фильтром"
      parameters:
        - name: type
          description: >
            Тип материала заказа. 
            Возможные варианты "plate", "tabletop", "edge", "furniture", "facade"
          required: false
          in: query
          schema:
            type: string
            example: "plate"
        - name: category
          description: "Список выбранных категорий через запятую."
          required: false
          in: query
          schema:
            type: string
            example: "43,47"
        - name: search
          description: "Строка поиска по названию."
          required: false
          in: query
          schema:
            type: string
            example: "MDF"
        - name: minPrice
          description: "Значение min фильтра по цене."
          required: false
          in: query
          schema:
            type: integer
            example: 100
        - name: maxPrice
          description: "Значение max фильтра по цене."
          required: false
          in: query
          schema:
            type: integer
            example: 500
        - name: attrChecked[]
          description: "Значение атрибута и его значения. Этот параметр может дублироваться."
          required: false
          in: query
          schema:
            type: string
            example: "{\"attributeId\":4,\"attributeVal\":12}"
        - name: group
          description: "Код группы товаров"
          required: false
          in: query
          schema:
            type: string
            example: "led_furniture"
      responses:
        200:
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  content:
                    type: object
                    properties:
                      products:
                        type: array
                        example: []
                      categories:
                        type: array
                        example: []
                      attributes:
                        type: array
                        example: []
                      groups:
                        type: array
                        example: []
                      total:
                        type: integer
                        description: "Общее количество отфильтрованных товаров"
                        example: 122
                      pages:
                        type: integer
                        description: "Общее количество страниц товаров"
                        example: 13
                      min_price:
                        type: integer
                        description: "Значение min цены по которым отфильтрованы товары"
                        example: 0
                      max_price:
                        type: integer
                        description: "Значение max цены по которым отфильтрованы товары"
                        example: 100
                      min_range:
                        type: integer
                        description: "Значение min цены отфильтрованных товаров"
                        example: 0
                      max_range:
                        type: integer
                        description: "Значение max цены отфильтрованных товаров"
                        example: 100
