openapi: 3.0.0
info:
  version: 'v.5.4.5'
  title: 'Luna-Admin API'
  description: |
          
          VisionLabs Luna Admin API.

          OpenAPI specification is the only valid document providing up-to-date information about the service API. 

          The specification can be used:

          - By documentation generation tools to visualize the API.
          - By code generation tools.

          All the documents and code generated using this specification can include inaccuracies and should be carefully checked.

          OpenAPI specification can be received using the "/docs/spec" resource. The "Accept" header should be set to "application/x-yaml".

servers:
- description: SwaggerHub API Auto Mocking
  url: https://virtserver.swaggerhub.com/visionlabs/luna-admin/v.5.4.5

components:
  headers:
    application_json:
      schema:
        type: string
        enum:
        - application/json
      required: true
      description: content type is application/json

    text_plain:
      schema:
        type: string
        enum:
        - text/plain
      required: true
      description: content type is text/plain

    text_html:
      schema:
        type: string
        enum:
          - text/html
      required: true
      description: content type is text/html

    luna_request_id:
      schema:
        type: string
        format: timestamp,uuid
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
      description: request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
      required: true

    authenticate:
      schema:
        type: string
        enum:
        - Basic realm="login:password"
      required: true
      description: authorization format

    content_disposition:
      schema:
        type: string
        format: attachment; filename=\d{4}-\d{2}-\d{2} \d{2}:\d{2}_luna_sys_info.json
        pattern: ^attachment; filename=\d{4}-\d{2}-\d{2} \d{2}:\d{2}_luna_sys_info.json$
      required: true
      description: recommended filename to save the response body

    docs_content_type:
      schema:
        type: string
        enum:
          - application/x-yaml
          - text/html
      required: true
      description: Type of receiving data

    config_accept_content_type:
      schema:
        type: string
        enum:
          - application/json
          - text/plain
      required: false
      description: The content type of the response body.
  parameters:
    authorization:
      in: header
      schema:
        type: string
        example: Basic dGVzdHVzZXI6dGVzdHB3ZA==
      description: base64 user:password string
      name: Authorization

    exclude_header:
      in: header
      schema:
        type: string
        example: WWW-Authorization
        enum:
          - "WWW-Authorization"
      description: Exclude header from response
      name: Exclude-Header

    luna_request_id:
      in: header
      schema:
        type: string
        format: timestamp,uuid
        pattern: ^[0-9]{10},[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$
        example: 1536751345,8b8b5937-2e9c-4e8b-a7a7-5caf86621b5a
      description: |
        external request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
        If it was not set, system will set it in default format ("timestamp,UUID"). It will be returned with response.
      name: Luna-Request-Id

    applicationJsonContent:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
        - application/json

    page_size:
      in: query
      name: page_size
      schema:
        type: integer
        minimum: 1
        maximum: 1000
        default: 10
        example: 146
      description: the number of items on page.

    task_type_schedulable:
      in: query
      name: task_type
      schema:
        $ref: '#/components/schemas/task_type_schedulable_reply'

    page:
      in: query
      name: page
      schema:
        type: integer
        minimum: 1
        default: 1
        example: 146
      description: a page number.

    account_id:
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'

    task_ids:
      in: query
      name: task_ids
      schema:
        $ref: '#/components/schemas/task_id'
      description: comma-separated task ids

    create_time__lt:
      in: query
      name: create_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}))$'

    create_time__gte:
      in: query
      name: create_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object create_time.
      example: "2018-08-11T09:10:41.674Z"
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}))$'

    end_time__lt:
      in: query
      name: end_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for object end_time.
      example: "2018-08-11T10:11:41.674Z"
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}))$'

    end_time__gte:
      in: query
      name: end_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for object end_time.
      example: "2018-08-11T10:10:41.674Z"
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}))$'

    task_type:
      in: query
      name: task_type
      schema:
        $ref: '#/components/schemas/task_type'

    task_status:
      in: query
      name: task_status
      schema:
        $ref: '#/components/schemas/task_status'

    error_ids:
      in: query
      name: error_ids
      schema:
        $ref: '#/components/schemas/error_ids'

    error_time__lt:
      in: query
      name: error_time__lt
      schema:
        $ref: '#/components/schemas/time'
      description: upper bound for error time.
      example: "2018-08-11T09:11:41.674Z"

    error_time__gte:
      in: query
      name: error_time__gte
      schema:
        $ref: '#/components/schemas/time'
      description: lower included bound for error_time.
      example: "2018-08-11T09:10:41.674Z"

    error_code:
      in: query
      name: error_code
      schema:
        $ref: '#/components/schemas/error_code'

    search_parameter:
      in: query
      name: q
      schema:
        oneOf:
          - $ref: '#/components/schemas/id'
          - $ref: '#/components/schemas/email'
      description: specify the id of an element or the e-mail of an account.
      example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

    accept_docs_handler:
      in: header
      name: Accept
      schema:
        $ref: '#/components/schemas/accept_docs_handler'
      required: true
      description: acceptable type of receiving data

    include_luna_services:
      in: query
      name: include_luna_services
      schema:
        type: integer
        enum: [0, 1]
        default: 0
      description: whether to perform healthchecks for dependent luna services.

    accept_config_handler:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - text/plain
        description: One of application/json, text/plain
      required: false
      description: acceptable type of receiving data

    schedule_patch:
      in: query
      name: action
      required: true
      schema:
        type: string
        enum: [pause, start]
      description: pause/start tasks schedule

    schedule_id_path:
      in: path
      name: schedule_id
      required: true
      schema:
        $ref: '#/components/schemas/schedule_id'
      description: Schedule according to which the task was created

    schedule_id:
      in: query
      name: schedule_id
      schema:
        $ref: '#/components/schemas/schedule_id'
      description: Schedule according to which the task was created
  schemas:
    AnyStandaloneType:
      description: any standalone type
      anyOf:
        - type: object
          additionalProperties: true
        - type: number
        - type: string
        - type: boolean

    Error:
      type: object
      properties:
        error_code:
          $ref: '#/components/schemas/error_code'
        desc:
          $ref: '#/components/schemas/error_description'
        detail:
          $ref: '#/components/schemas/error_detail'
        link:
          $ref: '#/components/schemas/error_link'
      required: [error_code, detail, desc, link]
      example:
        error_code: 11009
        detail: Internal server error
        desc: Internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009

    error_code:
      type: integer
      description: error code.
      example: 12010

    error_description:
      type: string
      description: short error description.
      example: Faces not found

    error_detail:
      type: string
      description: error detail.
      example: One or more faces not found, including face with id '8f4f0070-c464-460b-bf78-fac225df72e9'

    error_link:
      type: string
      description: Link to the documentation website with the error description.
      example: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12010

    uuid:
      type: string
      format: uuid
      pattern: '^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$'
      example: 557d54ec-29ad-4f3c-93b4-c9092ef12515

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: account id.

    id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: account id, list id, face id or attribute id.

    account_type:
      type: string
      enum: [ admin, advanced_user, user ]
      default: advanced_user
      description: Account type.

    account_description:
      type: string
      maxLength: 128
      description: Account description.
      default: ''
      example: Horns and Hooves

    login:
      type: string
      minLength: 3
      maxLength: 128
      pattern: ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$
      description: Account username.
      example: horns@hooves.com

    password:
      type: string
      minLength: 3
      maxLength: 128
      pattern: '^.{3,128}$'
      description: Account password.
      example: secret

    email:
      type: string
      format: email
      pattern: ^[a-z0-9_'\+\-\.]+@[a-z0-9]+\.[a-z]{2,}$
      maxLength: 64
      example: horns@hooves.com
      description: email address.
      deprecated: true

    organization_name:
      type: string
      maxLength: 128
      example: Horns and Hooves
      description: organization name.
      deprecated: true

    new_password:
      type: object
      properties:
        password:
          type: string
          minLength: 1
          maxLength: 128
          example: password
          pattern: '^.{1,128}$'
          description: a new password.

    user_data:
      description: user data.
      type: string
      maxLength: 128
      example: "good persons"

    list_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: list id.

    list_user_data:
      allOf:
        - $ref: '#/components/schemas/user_data'
        - description: user data associated with list.

    face_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: face id.

    attribute_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: attribute id, null if descriptor score is lower than score treshold.

    sample_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: sample id.

    gender:
      allOf:
        - $ref: '#/components/schemas/int01'
        - description: gender, 0 - female, 1 - male.

    ethnicities_enum:
      type: integer
      enum: [1, 2, 3, 4]
      description: |
        reference ethnicity.

        | ethnicity   | value |
        |-----------------|---|
        | AfricanAmerican | 1 |
        | Indian          | 2 |
        | Asian           | 3 |
        | Caucasian       | 4 |

    subtask_id:
      type: integer
      minimum: 1
      description: subtask id.
      example: 5

    subtask_content:
      type: object
      description: subtask content.
      additionalProperties:
        x-additionalPropertiesName: subtask content fields
        description: See for details the Luna Tasks documentation.

    subtask_status:
      type: integer
      enum: [0, 1, 2, 3, 4]
      example: 2
      description: |
        subtask status.

        | subtask status| value |
        |-------------------|---|
        | pending           | 0 |
        | in progress       | 1 |
        | cancelled         | 2 |
        | failed            | 3 |
        | done              | 4 |

    task_id:
      type: integer
      minimum: 1
      example: 123

    task_type:
      type: integer
      enum: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
      example: 3
      description: |
        task type

        | task type        | value |
        |----------------------|---|
        | unknown              | 0 |
        | linker               | 1 |
        | clusterization       | 2 |
        | report               | 3 |
        | garbage collect      | 4 |
        | additional extract   | 5 |
        | cross match          | 6 |
        | roc-curve calculation| 7 |
        | export objects       | 8 |
        | estimate data        | 9 |

    task_status:
      type: integer
      enum: [0, 1, 2, 3, 4, 5]
      example: 1
      description: |
        task status.

        | task status | value |
        |-----------------|---|
        | pending         | 0 |
        | in progress     | 1 |
        | cancelled       | 2 |
        | failed          | 3 |
        | collect results | 4 |
        | done            | 5 |

    count_task_parts_done:
      type: integer
      minimum: 0
      description: completed task part count.
      example: 10

    count_task_parts_all:
      type: integer
      minimum: 1
      description: task part count.
      example: 100

    error_id:
      type: integer
      description: error id.

    error_ids:
      type: string
      format: comma-separate error ids
      minItems: 1
      example: 4,5,6

    errors_additional_info:
      type: string
      description: additional error info.
      example: 8f4f0070-c464-460b-bf78-fac225df72e9

    time:
      type: string
      format: date-time
      example: "2018-07-11T09:11:41.674Z"

    time_end:
      type: string
      format: date-time
      example: "2018-07-11T10:11:41.674Z"

    int01:
      type: integer
      default: 0
      enum: [0, 1]

    int0100:
      type: integer
      minimum: 0
      maximum: 100
      example: 29

    count:
      type: integer
      minimum: 0
      example: 1

    int_version:
      type: integer
      minimum: 0

    version:
      type: object
      properties:
        api:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: an api version of service.
            - example: 1
        major:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: a major version of service.
            - example: 2
        minor:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: a minor version of service.
            - example: 3
        patch:
          allOf:
            - $ref: '#/components/schemas/int_version'
            - description: a patch version of service.
            - example: 4
      required: [api, major, minor, patch]

    version_handler_response:
      type: object
      properties:
        Version:
          $ref: "#/components/schemas/version"
      required: [Version]

      example:
        Version:
          api: 4
          major: 0
          minor: 0
          patch: 0

    account:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
        account_type:
          $ref: '#/components/schemas/account_type'
        description:
          $ref: '#/components/schemas/account_description'
        login:
          $ref: '#/components/schemas/login'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: token create time
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: token last update time
        email:
          $ref: '#/components/schemas/email'
        organization_name:
          $ref: '#/components/schemas/organization_name'
      required: [ account_id, account_type, description, login, email, organization_name, create_time, last_update_time ]

    registered_account_outdated:
      type: object
      properties:
        email:
          $ref: '#/components/schemas/email'
        organization_name:
          $ref: '#/components/schemas/organization_name'
      required: [ email, organization_name ]

    registered_account_recent:
      type: object
      properties:
        account_type:
          $ref: '#/components/schemas/account_type'
        login:
          $ref: '#/components/schemas/login'
        password:
          $ref: '#/components/schemas/password'
        description:
          $ref: '#/components/schemas/account_description'
      required: [ login, password ]

    registered_account:
      oneOf:
        - $ref: '#/components/schemas/registered_account_recent'
        - $ref: '#/components/schemas/registered_account_outdated'

    account_response:
      type: object
      properties:
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/account'
          description: list of accounts.
        account_count:
          allOf:
          - $ref: '#/components/schemas/count'
          - description: registered account count.
      required: [accounts, account_count]

    new_account_id:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [account_id]

    account_stats:
      type: object
      description: basic account stats.
      properties:
        list_count:
          allOf:
          - $ref: '#/components/schemas/count'
          - description: account list count.
        face_count:
          allOf:
          - $ref: '#/components/schemas/count'
          - description: account face count.
        face_attribute_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: account face attribute count.
      required: [face_attribute_count, list_count, face_count]

    account_info:
      type: object
      properties:
        info:
          $ref: '#/components/schemas/account'
        stats:
          $ref: '#/components/schemas/account_stats'
      required: [info, stats]

    list:
      type: object
      properties:
        list_id:
          $ref: '#/components/schemas/list_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: list update time (face was attached or detached, user_data was changed).
        face_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: face count.
        user_data:
          $ref: '#/components/schemas/list_user_data'
      required: [list_id, account_id, last_update_time, face_count, user_data]

    list_info:
      allOf:
        - $ref: '#/components/schemas/list'
        - description: list info.

    face:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: face create time.
      required: [face_id, account_id, create_time]

    face_info:
      allOf:
        - $ref: '#/components/schemas/face'
        - description: face info.

    attribute:
      type: object
      properties:
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        basic_attributes:
          type: object
          properties:
            gender:
              allOf:
                - $ref: '#/components/schemas/gender'
                - nullable: true
            age:
              allOf:
                - $ref: '#/components/schemas/int0100'
                - description: age.
                - nullable: true
            ethnicity:
              allOf:
                - $ref: '#/components/schemas/ethnicities_enum'
                - nullable: true
          required: [gender, age, ethnicity]
          description: basic attributes
        basic_attributes_samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          description: basic attribute samples
        face_descriptor:
          type: string
          nullable: true
        face_descriptor_samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          description: face descriptor samples
        create_time:
          $ref: '#/components/schemas/time'
      required: [account_id, attribute_id, basic_attributes, basic_attributes_samples,
                 face_descriptor, face_descriptor_samples, create_time]

    attribute_info:
      allOf:
        - $ref: '#/components/schemas/attribute'
        - description: temporary attribute info.

    search_response:
      type: object
      description: basic element info.
      properties:
        data:
          oneOf:
            - $ref: '#/components/schemas/account_info'
            - $ref: '#/components/schemas/list_info'
            - $ref: '#/components/schemas/face_info'
            - $ref: '#/components/schemas/attribute_info'
          nullable: true
        type:
          type: string
          enum: [account, list, face, attribute]
          nullable: true

    list_response:
      type: object
      description: list info.
      properties:
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list'
        list_count:
          allOf:
            - $ref: '#/components/schemas/count'
            - description: list count.

    task_description:
      type: string
      maxLength: 128
      description: task description.
      example: "task description"

    result_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      description: task result id in a storage.
      nullable: true

    subtask_in_reply:
      type: object
      properties:
        subtask_id:
          $ref: '#/components/schemas/subtask_id'
        task_id:
          $ref: '#/components/schemas/task_id'
        result_id:
          $ref: '#/components/schemas/result_id'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: subtask create time.
        end_time:
          allOf:
            - $ref: '#/components/schemas/time_end'
            - description: subtask end time.
        subtask_status:
          $ref: '#/components/schemas/subtask_status'
        content:
          $ref: '#/components/schemas/subtask_content'
      required: [subtask_id, task_id, create_time, subtask_status, content, result_id]

    subtasks_reply:
      type: object
      properties:
        subtasks:
          type: array
          items:
            $ref: '#/components/schemas/subtask_in_reply'
          minItems: 1
      required: [subtasks]

    task_error:
      type: object
      properties:
        error_id:
          $ref: '#/components/schemas/error_id'
        task_id:
          $ref: '#/components/schemas/task_id'
        subtask_id:
          allOf:
            - $ref: '#/components/schemas/task_id'
            - nullable: true
            - description: subtask id.
            - example: 5
        error_code:
          $ref: '#/components/schemas/error_code'
        description:
          allOf:
            - $ref: '#/components/schemas/error_description'
            - example: Faces not found
        detail:
          allOf:
            - $ref: '#/components/schemas/error_detail'
            - example: One or more faces not found, including face with id '8f4f0070-c464-460b-bf78-fac225df72e9'
        link:
          $ref: '#/components/schemas/error_link'
        error_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: error time.
        additional_info:
          allOf:
            - $ref: '#/components/schemas/errors_additional_info'
            - nullable: true
            - description: error additional info.
      required: [error_id, task_id, subtask_id, error_code, description, detail, link, error_time, additional_info]

    task_errors:
      description: task errors.
      type: object
      properties:
        errors:
          type: array
          items:
            $ref: '#/components/schemas/task_error'
          minItems: 0
          maxItems: 100000
          description: list of errors occurred while task processing.
      required: [errors]

    linker_task_content:
      type: object
      description: linker task content
      additionalProperties:
        x-additionalPropertiesName: linker task content fields
        description: See for details the Luna Tasks documentation.

    estimator_task_content:
      type: object
      description: estimator task content
      additionalProperties:
        x-additionalPropertiesName: estimator task content fields
        description: See for details the Luna Tasks documentation.

    store_results:
      type: boolean
      description: Whether to store task results. The task errors are stored in any case.
      default: true

    gc_events_task_content_no_filters:
      description: Garbage collecting task content to remove events
      type: object
      properties:
        target:
          type: string
          enum: ['events']
        store_results:
          $ref: '#/components/schemas/store_results'
        remove_samples:
          type: boolean
          description: |
            Whether to remove face and body samples along with the event.

            > **WARNING**: After removing samples, it will become impossible to re-extract the attribute or descriptor for the created face.
          default: false
        remove_image_origins:
          type: boolean
          description: |
            Whether to remove image origins along with the event.
          default: false
        filters:
          type: object
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: account id to execute task within the specified account
            handler_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: handler id to execute task within the specified handler
      required: [target, filters]

    gc_events_task_content:
      allOf:
        - $ref: '#/components/schemas/gc_events_task_content_no_filters'
      type: object
      properties:
        filters:
          type: object
          properties:
            create_time__lt:
              oneOf:
                - $ref: '#/components/schemas/create_time__lt'
                - $ref: '#/components/schemas/create_time_now__lt'
              description: Create time upper excluded boundary.
            insert_time__lt:
              oneOf:
                - $ref: '#/components/schemas/insert_time__lt'
                - $ref: '#/components/schemas/insert_time_now__lt'
              description: Insert time upper excluding boundary.

    gc_events_task_content_reply:
      allOf:
        - $ref: '#/components/schemas/gc_events_task_content_no_filters'
      type: object
      properties:
        filters:
          type: object
          properties:
            create_time__lt:
              $ref: '#/components/schemas/create_time__lt'
              description: Create time upper excluded boundary.
            insert_time__lt:
              $ref: '#/components/schemas/insert_time__lt'
              description: Insert time upper excluding boundary.

    gc_faces_task_content_no_filters:
      description: Garbage collecting task content to delete faces by extended filters.
      type: object
      properties:
        target:
          type: string
          enum: ['faces']
        store_results:
          $ref: '#/components/schemas/store_results'
        remove_samples:
          type: boolean
          description: |
            Whether to remove face descriptor and basic attributes samples along with the face.
          default: false
      required: [target, filters]

    gc_faces_task_content:
      allOf:
        - $ref: '#/components/schemas/gc_faces_task_content_no_filters'
      type: object
      properties:
        filters:
          type: object
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: account id to execute task within the specified account
            create_time__lt:
              oneOf:
                - $ref: '#/components/schemas/create_time__lt'
                - $ref: '#/components/schemas/create_time_now__lt'
              description: create time upper excluding boundary in format RFC 3339
            create_time__gte:
              oneOf:
                - $ref: '#/components/schemas/create_time__gte'
                - $ref: '#/components/schemas/create_time_now__gte'
              description: create time lower including boundary in format RFC 3339
            user_data:
              $ref: '#/components/schemas/user_data'
            list_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: list id.

    gc_faces_task_content_reply:
      allOf:
        - $ref: '#/components/schemas/gc_faces_task_content_no_filters'
      type: object
      properties:
        filters:
          type: object
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: account id to execute task within the specified account
            create_time__lt:
              $ref: '#/components/schemas/create_time__lt'
              description: create time upper excluding boundary in format RFC 3339
            create_time__gte:
              $ref: '#/components/schemas/create_time__gte'
              description: create time lower including boundary in format RFC 3339
            user_data:
              $ref: '#/components/schemas/user_data'
            list_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
                - description: list id.

    gc_face_descriptors_task_content:
      description: Garbage collecting task content to delete face descriptors by version.
      type: object
      properties:
        target:
          type: string
          enum: ['face_descriptors']
        filters:
          type: object
          properties:
            descriptor_version:
              type: integer
              description: version of face descriptors to delete
          required: [descriptor_version]
        store_results:
          $ref: '#/components/schemas/store_results'
      required: [target, filters]

    gc_face_filters:
      type: object
      description: face descriptor filters
      properties:
        descriptor_version:
          type: integer
          description: version of face descriptors to delete
        descriptor_type:
          description: Descriptors type.
          type: string
          enum: ['face']
      required: [descriptor_version, descriptor_type]

    gc_body_filters:
      type: object
      description: body descriptor filters
      properties:
        descriptor_version:
          type: integer
          description: version of body descriptors to delete
        descriptor_type:
          description: Descriptors type.
          type: string
          enum: ['body']
        store_results:
          $ref: '#/components/schemas/store_results'
      required: [descriptor_version, descriptor_type]

    gc_event_descriptors_task_content:
      description: Garbage collecting task content to delete event descriptors by version and type.
      type: object
      properties:
        target:
          type: string
          enum: ['event_descriptors']
        filters:
          oneOf:
            - $ref: '#/components/schemas/gc_face_filters'
            - $ref: '#/components/schemas/gc_body_filters'
          discriminator:
            propertyName: descriptor_type
            mapping:
              face: '#/components/schemas/gc_face_filters'
              body: '#/components/schemas/gc_body_filters'
        store_results:
          $ref: '#/components/schemas/store_results'
      required: [target, filters]

    gc_task_content:
      description: gc task content
      oneOf:
        - $ref: '#/components/schemas/gc_face_descriptors_task_content'
        - $ref: '#/components/schemas/gc_event_descriptors_task_content'
        - $ref: '#/components/schemas/gc_events_task_content'
        - $ref: '#/components/schemas/gc_faces_task_content'
      discriminator:
        propertyName: "target"
        mapping:
          face_descriptors: '#/components/schemas/gc_face_descriptors_task_content'
          event_descriptors: '#/components/schemas/gc_event_descriptors_task_content'
          events: '#/components/schemas/gc_events_task_content'
          faces: '#/components/schemas/gc_faces_task_content'

    gc_task:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task
          example: gc task one
        content:
          $ref: '#/components/schemas/gc_task_content'
      required: [content]

    cross_match_task_content:
      type: object
      description: cross match task content.
      additionalProperties:
        x-additionalPropertiesName: cross match task content fields
        description: See for details the Luna Tasks documentation.

    roc_task_content:
      type: object
      description: ROC-curve calculating task content.
      additionalProperties:
        x-additionalPropertiesName: ROC-curve task content fields
        description: See for details the Luna Tasks documentation.

    clustering_task_content:
      type: object
      description: clustering task content.
      additionalProperties:
        x-additionalPropertiesName: clustering task content fields
        description: See for details the Luna Tasks documentation.

    exporter_task_content:
      type: object
      description: exporter task content.
      additionalProperties:
        x-additionalPropertiesName: exporter task content fields
        description: See for details the Luna Tasks documentation.

    reporter_task_content:
      type: object
      description: reporter task content.
      additionalProperties:
        x-additionalPropertiesName: reporter task content fields
        description: See for details the Luna Tasks documentation.

    ae_face_filters:
      description: face filters.
      type: object
      properties:
        objects_type:
          description: object type.
          type: string
          enum: [ "faces" ]
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id.
        face_id__lt:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: upper face id excluding boundary.
        face_id__gte:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: lower face id including boundary.
      required: [ objects_type ]

    ae_event_filters_no_inspect_time:
      description: event filters.
      type: object
      properties:
        objects_type:
          description: object type.
          type: string
          enum: [ "events" ]
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id.
        handler_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: handler id.
        event_id__gte:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: lower event id including boundary.
        event_id__lt:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: upper event id excluding boundary.

    ae_event_filters:
      allOf:
        - $ref: "#/components/schemas/ae_event_filters_no_inspect_time"
      properties:
        insert_time__gte:
          oneOf:
            - $ref: '#/components/schemas/insert_time__gte'
            - $ref: '#/components/schemas/insert_time_now__gte'
          description: event insert time lower including boundary.
        insert_time__lt:
          oneOf:
            - $ref: '#/components/schemas/insert_time__lt'
            - $ref: '#/components/schemas/insert_time_now__lt'
          description: event insert time upper excluding boundary.
      required: [ objects_type ]

    ae_event_filters_reply:
      allOf:
        - $ref: "#/components/schemas/ae_event_filters_no_inspect_time"
      properties:
        insert_time__gte:
          $ref: '#/components/schemas/insert_time__gte'
          description: event insert time lower including boundary.
        insert_time__lt:
          $ref: '#/components/schemas/insert_time__lt'
          description: event insert time upper excluding boundary.
      required: [ objects_type ]

    additional_extract_task_content_body_descriptor_no_filters:
      description: additional extract human descriptors task
      type: object
      properties:
        extraction_target:
          description: extraction target
          type: string
          enum: [ "body_descriptor" ]
        options:
          description: extract task options
          type: object
          properties:
            descriptor_version:
              description: version of descriptors to extract
              type: integer
            missing:
              type: boolean
              description: whether to extract only missing descriptors (`false` is not implemented)
              default: true
          required: [ descriptor_version ]

    additional_extract_task_content_body_descriptor:
      allOf:
        - $ref: '#/components/schemas/additional_extract_task_content_body_descriptor_no_filters'
      type: object
      properties:
        filters:
          allOf:
            - description: |
                object filters.
                Body descriptor re-extraction can be performed on events only (see `objects_type` in filters).
            - $ref: '#/components/schemas/ae_event_filters'
      required: [ extraction_target, options, filters ]

    additional_extract_task_content_body_descriptor_reply:
      allOf:
        - $ref: '#/components/schemas/additional_extract_task_content_body_descriptor_no_filters'
      type: object
      properties:
        filters:
          allOf:
            - description: |
                object filters.
                Body descriptor re-extraction can be performed on events only (see `objects_type` in filters).
            - $ref: '#/components/schemas/ae_event_filters_reply'
      required: [ extraction_target, options, filters ]

    additional_extract_task_content_face_descriptor_no_filters:
      description: additional extract face descriptors task
      type: object
      properties:
        extraction_target:
          description: extraction target
          type: string
          enum: [ "face_descriptor" ]
        options:
          description: extract task options
          type: object
          properties:
            descriptor_version:
              description: version of descriptors to extract
              type: integer
            missing:
              type: boolean
              description: whether to extract only missing descriptors (`false` is not implemented)
              default: true
          required: [ descriptor_version ]

    additional_extract_task_content_face_descriptor:
      allOf:
        - $ref: '#/components/schemas/additional_extract_task_content_face_descriptor_no_filters'
      type: object
      properties:
        filters:
          description: |
            object filters.
            Face descriptor re-extraction can be performed on either faces or events (see `objects_type` in filters).
          oneOf:
            - $ref: '#/components/schemas/ae_face_filters'
            - $ref: '#/components/schemas/ae_event_filters'
          discriminator:
            propertyName: objects_type
            mapping:
              faces: '#/components/schemas/ae_face_filters'
              events: '#/components/schemas/ae_event_filters'
      required: [ extraction_target, options, filters ]

    additional_extract_task_content_face_descriptor_reply:
      allOf:
        - $ref: '#/components/schemas/additional_extract_task_content_face_descriptor_no_filters'
      type: object
      properties:
        filters:
          description: |
            object filters.
            Face descriptor re-extraction can be performed on either faces or events (see `objects_type` in filters).
          oneOf:
            - $ref: '#/components/schemas/ae_face_filters'
            - $ref: '#/components/schemas/ae_event_filters_reply'
          discriminator:
            propertyName: objects_type
            mapping:
              faces: '#/components/schemas/ae_face_filters'
              events: '#/components/schemas/ae_event_filters_reply'
      required: [ extraction_target, options, filters ]

    additional_extract_task_content_basic_attributes_no_filters:
      description: additional extract basic attributes task
      type: object
      properties:
        extraction_target:
          description: extraction target
          type: string
          enum: [ "basic_attributes" ]
        options:
          type: object
          description: extract task options
          properties:
            missing:
              type: boolean
              description: whether to extract only missing basic attributes (`false` is not implemented)
              default: true

    additional_extract_task_content_basic_attributes:
      allOf:
        - $ref: '#/components/schemas/additional_extract_task_content_basic_attributes_no_filters'
      type: object
      properties:
        filters:
          description: |
            object filters.
            Basic attributes re-extraction can be performed on either faces or events (see `objects_type` in filters).
          oneOf:
            - $ref: '#/components/schemas/ae_face_filters'
            - $ref: '#/components/schemas/ae_event_filters'
          discriminator:
            propertyName: objects_type
            mapping:
              faces: '#/components/schemas/ae_face_filters'
              events: '#/components/schemas/ae_event_filters'
      required: [ extraction_target, options, filters ]

    additional_extract_task_content_basic_attributes_reply:
      allOf:
        - $ref: '#/components/schemas/additional_extract_task_content_basic_attributes_no_filters'
      type: object
      properties:
        filters:
          description: |
            object filters.
            Basic attributes re-extraction can be performed on either faces or events (see `objects_type` in filters).
          oneOf:
            - $ref: '#/components/schemas/ae_face_filters'
            - $ref: '#/components/schemas/ae_event_filters_reply'
          discriminator:
            propertyName: objects_type
            mapping:
              faces: '#/components/schemas/ae_face_filters'
              events: '#/components/schemas/ae_event_filters_reply'
      required: [ extraction_target, options, filters ]

    additional_extract_task_content:
      description: additional extract task.
      oneOf:
          - $ref: '#/components/schemas/additional_extract_task_content_basic_attributes'
          - $ref: '#/components/schemas/additional_extract_task_content_face_descriptor'
          - $ref: '#/components/schemas/additional_extract_task_content_body_descriptor'
      discriminator:
        propertyName: extraction_target
        mapping:
          basic_attributes: '#/components/schemas/additional_extract_task_content_basic_attributes'
          face_descriptor: '#/components/schemas/additional_extract_task_content_face_descriptor'
          body_descriptor: '#/components/schemas/additional_extract_task_content_body_descriptor'

    additional_extract_task:
      type: object
      properties:
        description:
          type: string
          description: provided user data for current task.
          example: additional extract usefull faces
        content:
          $ref: '#/components/schemas/additional_extract_task_content'
      required: [content]

    time_nullable:
      type: string
      nullable: true
      format: date-time
      example: "2018-08-11T10:11:41.674Z"

    task_template_reply:
      type: object
      properties:
        task_id:
          $ref: '#/components/schemas/task_id'
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: task create time
        end_time:
          allOf:
            - $ref: '#/components/schemas/time_nullable'
          description: task end time
        last_update_time:
          allOf:
            - description: task last update time
          $ref: '#/components/schemas/time_nullable'
        task_status:
          $ref: '#/components/schemas/task_status'
        result_id:
          $ref: '#/components/schemas/result_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        count_task_parts_done:
          $ref: '#/components/schemas/count_task_parts_done'
        count_task_parts_all:
          $ref: '#/components/schemas/count_task_parts_all'
        description:
          $ref: '#/components/schemas/task_description'
      required: [ task_id, create_time, last_update_time, task_type, task_status, count_task_parts_done,
                  count_task_parts_all, content ]

    schedulable_task_template_reply:
      allOf:
        - $ref: '#/components/schemas/task_template_reply'
        - properties:
            schedule_id:
              $ref: '#/components/schemas/schedule_id'

    task_linker_reply:
      allOf:
        - $ref: "#/components/schemas/schedulable_task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 1 ]
        content:
          $ref: "#/components/schemas/linker_task_content"

    task_clustering_reply:
      allOf:
        - $ref: "#/components/schemas/schedulable_task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 2 ]
        content:
          $ref: "#/components/schemas/clustering_task_content"

    task_report_reply:
      allOf:
        - $ref: "#/components/schemas/task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 3 ]
        content:
          $ref: "#/components/schemas/reporter_task_content"

    task_gc_reply:
      allOf:
        - $ref: "#/components/schemas/schedulable_task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 4 ]
        content:
          description: Garbage collecting task content
          oneOf:
            - $ref: '#/components/schemas/gc_face_descriptors_task_content'
            - $ref: '#/components/schemas/gc_faces_task_content_reply'
            - $ref: '#/components/schemas/gc_event_descriptors_task_content'
            - $ref: '#/components/schemas/gc_events_task_content_reply'
          discriminator:
            propertyName: target
            mapping:
              face_descriptors: '#/components/schemas/gc_face_descriptors_task_content'
              faces: '#/components/schemas/gc_faces_task_content_reply'
              event_descriptors: '#/components/schemas/gc_event_descriptors_task_content'
              events: '#/components/schemas/gc_events_task_content_reply'

    task_additional_extract_reply:
      allOf:
        - $ref: "#/components/schemas/schedulable_task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 5 ]
        content:
          description: additional extractor task content.
          oneOf:
            - $ref: '#/components/schemas/additional_extract_task_content_basic_attributes_reply'
            - $ref: '#/components/schemas/additional_extract_task_content_face_descriptor_reply'
            - $ref: '#/components/schemas/additional_extract_task_content_body_descriptor_reply'
          discriminator:
            propertyName: extraction_target
            mapping:
              basic_attributes: '#/components/schemas/additional_extract_task_content_basic_attributes_reply'
              face_descriptor: '#/components/schemas/additional_extract_task_content_face_descriptor_reply'
              body_descriptor: '#/components/schemas/additional_extract_task_content_body_descriptor_reply'

    task_cross_match_reply:
      allOf:
        - $ref: "#/components/schemas/task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 6 ]
        content:
          $ref: "#/components/schemas/cross_match_task_content"

    task_roc_reply:
      allOf:
        - $ref: "#/components/schemas/task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 7 ]
        content:
          $ref: "#/components/schemas/roc_task_content"

    task_exporter_reply:
      allOf:
        - $ref: "#/components/schemas/schedulable_task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [ 8 ]
        content:
          $ref: "#/components/schemas/exporter_task_content"

    task_estimator_reply:
      allOf:
        - $ref: "#/components/schemas/schedulable_task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [9]
        content:
          $ref: "#/components/schemas/estimator_task_content"

    task_reply:
      oneOf:
        - $ref: "#/components/schemas/task_linker_reply"
        - $ref: "#/components/schemas/task_clustering_reply"
        - $ref: "#/components/schemas/task_report_reply"
        - $ref: "#/components/schemas/task_gc_reply"
        - $ref: "#/components/schemas/task_additional_extract_reply"
        - $ref: "#/components/schemas/task_cross_match_reply"
        - $ref: "#/components/schemas/task_roc_reply"
        - $ref: "#/components/schemas/task_exporter_reply"
        - $ref: "#/components/schemas/task_estimator_reply"
      discriminator:
        propertyName: task_type
        mapping:
          1: '#/components/schemas/task_linker_reply'
          2: '#/components/schemas/task_clustering_reply'
          3: '#/components/schemas/task_report_reply'
          4: '#/components/schemas/task_gc_reply'
          5: '#/components/schemas/task_additional_extract_reply'
          6: '#/components/schemas/task_cross_match_reply'
          7: '#/components/schemas/task_roc_reply'
          8: '#/components/schemas/task_exporter_reply'
          9: '#/components/schemas/task_estimator_reply'

    task_response:
      type: object
      description: task info.
      properties:
        tasks:
          type: array
          items:
            $ref: '#/components/schemas/task_reply'

    task_count:
      type: object
      description: task count.
      properties:
        count:
          allOf:
            - $ref: '#/components/schemas/count'
            - example: 40

    task_result:
      type: object
      description: task result.
      additionalProperties:
        x-additionalPropertiesName: task result fields
        description: See for details the Luna Tasks documentation.

    error_count:
      type: object
      description: error count.
      properties:
        count:
          allOf:
            - $ref: '#/components/schemas/count'
            - example: 5

    services_versions:
      type: object
      description: versions of luna services.
      properties:
        luna-admin:
          $ref: '#/components/schemas/version'
        luna-accounts:
          $ref: '#/components/schemas/version'
        luna-sender:
          $ref: '#/components/schemas/version'
        luna-image-store-task-results:
          $ref: '#/components/schemas/version'
        luna-events:
          $ref: '#/components/schemas/version'
        luna-tasks:
          $ref: '#/components/schemas/version'
        luna-faces:
          $ref: '#/components/schemas/version'
        luna-image-store-faces-samples:
          $ref: '#/components/schemas/version'
        luna-image-store-bodies-samples:
          $ref: '#/components/schemas/version'
        luna-image-store-images:
          $ref: '#/components/schemas/version'
        luna-api:
          $ref: '#/components/schemas/version'
        luna-configurator:
          $ref: '#/components/schemas/version'
        luna-handlers:
          $ref: '#/components/schemas/version'
        luna-python-matcher:
          $ref: '#/components/schemas/version'
        luna-matcher-proxy:
          $ref: '#/components/schemas/version'
        luna-licenses:
          $ref: '#/components/schemas/version'
        luna-remote-sdk:
          $ref: '#/components/schemas/version'
        luna-lambda:
          $ref: '#/components/schemas/version'
        LUNA PLATFORM:
          type: object
          description: versions of luna services.
          properties:
            major:
              allOf:
                - $ref: '#/components/schemas/int_version'
                - description: a major version of service.
                - example: 2
            minor:
              allOf:
                - $ref: '#/components/schemas/int_version'
                - description: a minor version of service.
                - example: 3
            patch:
              allOf:
                - $ref: '#/components/schemas/int_version'
                - description: a patch version of service.
                - example: 4
          required: [major, minor, patch]

    face_descriptor_version:
      type: integer
      description: the face descriptor version
      enum: [46, 52, 54, 56, 57, 58, 59, 60]
      example: 56

    descriptor_info:
      type: array
      items:
        type: object
        properties:
          descriptor_version:
            $ref: '#/components/schemas/face_descriptor_version'
          descriptor_count:
            $ref: '#/components/schemas/count'
        required: [descriptor_version, descriptor_count]

    setting:
      type: object
      description: single setting.
      properties:
        id:
          type: integer
          example: 34
        tags:
          type: array
          items:
            type: string
          example: ['tag1', 'tag2']
        name:
          type: string
          example: SAVE_EVENTS_TIMEOUT
        value:
          anyOf:
            - $ref: "#/components/schemas/AnyStandaloneType"
            - type: array
              items:
                - $ref: "#/components/schemas/AnyStandaloneType"
          example: 2
        description:
          type: string
          example: save events timeout. 0 or negative means no timeout
        create_time:
          $ref: '#/components/schemas/time'
        last_update_time:
          $ref: '#/components/schemas/time'
        is_default:
          type: boolean
      required: [id, tags, name, value, description, create_time, last_update_time, is_default]

    configs:
      description: all platform settings.
      type: array
      items:
        $ref: '#/components/schemas/setting'

    license_period:
      type: object
      properties:
        is_available:
          type: boolean
          description: whether the license is valid
          example: True
        value:
          oneOf:
            - type: string
              format: date-time
              example: "2021-08-11T09:11:41.674Z"
            - type: string
              enum: [ PERPETUAL ]

    license_feature:
      type: object
      properties:
        is_available:
          type: boolean
          description: whether the license feature is available
          example: True
        value:
          type: integer
          nullable: True
          description: license feature current value

    license_info:
      type: object
      description: current license data
      properties:
        expiration_time:
          allOf:
            - $ref: '#/components/schemas/license_period'
            - description: expiration time of your license
        faces_limit:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: |
                information about allowed faces database size:

                - feature availability. When the limit is exceeded, the 'False' value is returned.

                - maximum number of faces with attached attributes
          example:
            is_available: True
            value: 1000
        liveness:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about liveness feature availability
          example:
            is_available: True
            value: 1
        liveness_balance:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: remaining liveness executions
          example:
            is_available: True
            value: 100000
        streams_limit:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: maximum number of streams
          example:
            is_available: True
            value: 1000
        iso:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about ISO feature availability.
          example:
            is_available: True
            value: 1
        body_attributes:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about body attributes estimation feature availability.
          example:
            is_available: True
            value: 1
        index:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about matching index feature availability.
          example:
            is_available: True
            value: 1
        people_counter:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about people counter feature availability.
          example:
            is_available: True
            value: 1
        lambdas:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about lambdas feature availability.
          example:
            is_available: True
            value: 1
        deepfake:
          allOf:
            - $ref: '#/components/schemas/license_feature'
            - description: information about deepfake feature availability.
          example:
            is_available: True
            value: 1
      required: [expiration_time, faces_limit, liveness]

    system_info:
      type: object
      description: all system info.
      properties:
        services_versions:
          $ref: '#/components/schemas/services_versions'
        descriptor_info:
          $ref: '#/components/schemas/descriptor_info'
        configs:
          $ref: '#/components/schemas/configs'
        current_faces_attributes_count:
          type: integer
          minimum: 0
          description: current faces attributes count
          example: 10
        license_info:
          $ref: '#/components/schemas/license_info'
        signature:
          type: string
        stats:
          type: object
          nullable: true
          properties:
            estimators_stats:
              type: array
              items:
                type: object
                properties:
                  count:
                    type: integer
                    description: amount of the estimations.
                    minimum: 1
                  month:
                    type: string
                    description: month of the interest (events occurred during this month).
                    example: '2021-09'
                  name:
                    type: string
                    description: name of the estimator.
                    example: body_descriptor_extractor_usages
                required: [count, month, name]
            estimators_performance_stats:
              type: array
              items:
                type: object
                properties:
                  month:
                    type: string
                    description: month of the interest (events occurred during this month).
                    example: '2021-09'
                  name:
                    type: string
                    description: name of the estimator.
                    example: body_descriptor
                  execution_time:
                    type: number
                    description: estimation time (mean value).
                    minimum: 0
                    example: 0.029135203011156546
                  batch_size:
                    type: number
                    description: estimation batch size (mean value).
                    minimum: 0
                    example: 1.0952380952380951
                required: [ month, name, execution_time, batch_size ]
            image_processing_stats:
              type: array
              items:
                type: object
                properties:
                  month:
                    type: string
                    description: month of the interest (events occurred during this month).
                    example: '2021-09'
                  image_load_time:
                    type: number
                    description: image load time (mean value).
                    minimum: 0
                    example: 0.006479793069339647
                  image_size:
                    type: object
                    additionalProperties: true
                    description: image size histogram-like counts.
                    example:
                      w_1000_h_1050: 4
                      w_1000_h_800: 212
                      w_250_h_250: 358
                  face_detection_size:
                    type: object
                    additionalProperties: true
                    description: face detection size histogram-like counts.
                    example:
                      h_100: 2
                      h_180: 197
                      h_1730: 4
                required: [ month, image_load_time, image_size, face_detection_size ]
            routes_stats:
              type: array
              items:
                type: object
                properties:
                  service:
                    type: string
                    description: name of the service.
                    example: luna-api
                  route:
                    type: string
                    description: code in format 'HTTP_METHOD:URI'
                    example: 'GET:/version'
                  month:
                    type: string
                    description: month of the interest (events occurred during this month).
                    example: '2021-09'
                  errors:
                    type: array
                    items:
                      type: object
                      properties:
                        count:
                          type: integer
                          minimum: 1
                        error_code:
                          type: string
                          example: '12012'
                      required: [count, error_code]
                  request_stats:
                    type: array
                    items:
                      type: object
                      properties:
                        count:
                          type: integer
                          minimum: 1
                        status_code:
                          type: string
                          example: '200'
                      required: [count, status_code]
                required: [service, route, month, errors, request_stats]

      required: [services_versions, descriptor_info, configs, license_info, current_faces_attributes_count,
                 signature]

    accept_docs_handler:
      type: string
      enum: [application/x-yaml, text/html]

    health_ok:
      description: successful healthcheck execution info
      type: object
      properties:
        execution_time:
          type: number
          example: 0.123
          description: request execution time in seconds
      required: [execution_time]

    health_errors:
      type: object
      properties:
        errors:
          description: failed healthcheck execution info
          type: array
          items:
            type: object
            properties:
              component:
                description: component name
                type: string
              error:
                allOf:
                  - description: healthcheck error
                  - $ref: '#/components/schemas/Error'
              status:
                description: component health status
                type: integer
                enum: [0, 1]
            required: [component, error, status]
      required: [errors]
      example:
        errors:
          - component: accounts
            error:
              error_code: 38001
              desc: Health check error
              detail: GET:http:\/\/accounts:5170\/version:Cannot connect to host accounts:5170 ssl:default [Name or service not known]
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-38001

            status: 0

    insert_time_now__gte:
      allOf:
        - $ref: '#/components/schemas/now_delta_time_filter'
      description: |
        End time lower included boundary in format `now-time`, where time must be present as follows:

        | Parameter value | Description  |
        |---------------------|--------------|
        | `1m`                | one minute   |
        | `2h`                | two hours    |
        | `7d`                | seven days   |
        | `5w`                | five weeks   |
        | `3M`                | three months |
        | `10y`               | ten years    |

    insert_time_now__lt:
      allOf:
        - $ref: '#/components/schemas/now_delta_time_filter'
      description: |
        End time upper excluded boundary in format `now-time`, where time must be present as follows:

        | Parameter value | Description  |
        |---------------------|--------------|
        | `1m`                | one minute   |
        | `2h`                | two hours    |
        | `7d`                | seven days   |
        | `5w`                | five weeks   |
        | `3M`                | three months |
        | `10y`               | ten years    |
        
    insert_time__gte:
      allOf:
        - $ref: '#/components/schemas/time'
      description: Event insert time lower excluding boundary.
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}|[+-]\d{2}:\d{2}))$'
      example: "2018-08-11T09:11:41.674Z"

    insert_time__lt:
      allOf:
        - $ref: '#/components/schemas/time'
      description: Event insert time upper excluding boundary.
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}|[+-]\d{2}:\d{2}))$'
      example: "2018-08-11T09:11:41.674Z"

    now_delta_time_filter:
      type: string
      pattern: '^now-(\d+)[smhdwMy]$'
      example: "now-2d"

    create_time_now__gte:
      allOf:
        - $ref: '#/components/schemas/now_delta_time_filter'
      description: |
            Create time lower included boundary in format `now-time`, where time must be present as follows:

            | Parameter value | Description  |
            |---------------------|--------------|
            | `1m`                | one minute   |
            | `2h`                | two hours    |
            | `7d`                | seven days   |
            | `5w`                | five weeks   |
            | `3M`                | three months |
            | `10y`               | ten years    |

    create_time_now__lt:
      allOf:
        - $ref: '#/components/schemas/now_delta_time_filter'
      description: |
            Create time upper excluded boundary in format `now-time`, where time must be present as follows:

            | Parameter value | Description  |
            |---------------------|--------------|
            | `1m`                | one minute   |
            | `2h`                | two hours    |
            | `7d`                | seven days   |
            | `5w`                | five weeks   |
            | `3M`                | three months |
            | `10y`               | ten years    |

    create_time__gte:
      allOf:
        - $ref: '#/components/schemas/time'
      description: Create time lower included boundary.
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}|[+-]\d{2}:\d{2}))$'
      example: "2018-08-11T09:11:41.674Z"

    create_time__lt:
      allOf:
        - $ref: '#/components/schemas/time'
      description: Create time upper excluded boundary.
      pattern: '^(\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}(Z|\.\d+Z|\.\d+[+-]\d{2}:\d{2}|[+-]\d{2}:\d{2}))$'
      example: "2018-08-11T09:11:41.674Z"

    schedule_id:
      allOf:
      - $ref: '#/components/schemas/task_id'
      description: schedule id

    schedule_trigger:
      type: object
      description: task schedule trigger
      properties:
        cron:
          type: string
          maxLength: 128
          example: 5 4 * * *
          description: |
            cron expression
            
            | expression | description          |
            |------------|----------------------|
            | *	         | any value            |
            | ,          | value list separator |
            | -          | range of values      |
            | /          | step values          |

        cron_timezone:
          type: string
          enum: [utc, local]
          description: cron timezone - utc or local
          default: local
      required: [cron]

    schedule_behaviour:
      type: object
      description: schedule behaviour parameters
      properties:
        start_immediately:
          type: bool
          default: false
          description: whether to create first task immediately regardless to schedule
        create_stopped:
          type: bool
          default: false
          description: |
            whether to create schedule and not execute any tasks

            expected that schedule will execute by user manually in future

    task_schedule_template:
      type: object
      description: tasks schedule
      required: [task_type, content]

    task_type_schedulable:
      type: integer
      enum: [4, 5]
      example: 4
      description: |
        task type

        | task type            | value |
        |----------------------|-------|
        | garbage collect      | 4     |
        | additional extract   | 5     |

    task_type_schedulable_reply:
      type: integer
      enum: [1, 2, 4, 5, 8]
      example: 1
      description: |
        task type

        | task type            | value |
        |----------------------|-------|
        | linker               | 1     |
        | clusterization       | 2     |
        | garbage collect      | 4     |
        | additional extract   | 5     |
        | export objects       | 8     |
        | estimator            | 9     |

    schedule_status:
      type: string
      enum: [running, stopped]
      description: |
        schedule status

        | status  | description                                  |
        |---------|----------------------------------------------|
        | running | schedule is running                          |
        | stopped | schedule is stopped by user                  |

    schedule_gc_task_content:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable"
        content:
          $ref: "#/components/schemas/gc_task_content"

    schedule_gc_task_content_reply:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable_reply"
        content:
          $ref: "#/components/schemas/gc_task_content"

    schedule_ae_task_content:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable"
        content:
          $ref: "#/components/schemas/additional_extract_task_content"

    schedule_ae_task_content_reply:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable_reply"
        content:
          $ref: "#/components/schemas/additional_extract_task_content"

    schedule_clustering_task_content_reply:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable_reply"
        content:
          $ref: "#/components/schemas/clustering_task_content"

    schedule_exporter_task_content_reply:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable_reply"
        content:
          $ref: "#/components/schemas/exporter_task_content"

    schedule_estimator_task_content_reply:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable_reply"
        content:
          $ref: "#/components/schemas/estimator_task_content"

    task_schedulable:
      description: task schedule
      oneOf:
        - $ref: '#/components/schemas/schedule_gc_task_content'
        - $ref: '#/components/schemas/schedule_ae_task_content'
      discriminator:
        propertyName: task_type
        mapping:
          4: '#/components/schemas/schedule_gc_task_content'
          5: '#/components/schemas/schedule_ae_task_content'

    schedule_linker_task_content:
      allOf:
        - $ref: "#/components/schemas/task_schedule_template"
      properties:
        task_type:
          $ref: "#/components/schemas/task_type_schedulable_reply"
        content:
          $ref: "#/components/schemas/linker_task_content"

    task_schedulable_reply:
      description: task schedule
      anyOf:
        - $ref: '#/components/schemas/schedule_linker_task_content'
        - $ref: '#/components/schemas/schedule_clustering_task_content_reply'
        - $ref: '#/components/schemas/schedule_gc_task_content_reply'
        - $ref: '#/components/schemas/schedule_ae_task_content_reply'
        - $ref: '#/components/schemas/schedule_exporter_task_content_reply'
        - $ref: '#/components/schemas/schedule_estimator_task_content_reply'
      discriminator:
        propertyName: task_type
        mapping:
          1: '#/components/schemas/schedule_linker_task_content'
          2: '#/components/schemas/schedule_clustering_task_content_reply'
          4: '#/components/schemas/schedule_gc_task_content_reply'
          5: '#/components/schemas/schedule_ae_task_content_reply'
          8: '#/components/schemas/schedule_exporter_task_content_reply'
          9: '#/components/schemas/schedule_estimator_task_content_reply'

    schedule:
      type: object
      description: tasks schedule
      properties:
        task:
          $ref: '#/components/schemas/task_schedulable'
        trigger:
          $ref: '#/components/schemas/schedule_trigger'
        behaviour:
          $ref: '#/components/schemas/schedule_behaviour'
      required: [trigger, task]

    schedule_reply:
      type: object
      properties:
        schedule_id:
          $ref: '#/components/schemas/schedule_id'
        task_ids:
          type: array
          items:
            $ref: '#/components/schemas/task_id'
          example: [1,2,3]
          description: list of executed task ids in descending order
        task:
          $ref: '#/components/schemas/task_schedulable_reply'
        trigger:
          $ref: '#/components/schemas/schedule_trigger'
        status:
          $ref: '#/components/schemas/schedule_status'
        next_run_time:
          allOf:
            - $ref: '#/components/schemas/time'
          nullable: True
          description: estimated time for next task
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: schedule create time
        last_update_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: schedule last update time
      required:
        - schedule_id
        - task_ids
        - task
        - trigger
        - status
        - next_run_time
        - create_time
        - last_update_time

    schedules_reply:
      type: array
      items:
        $ref: '#/components/schemas/schedule_reply'
  responses:
    internal_server_error:
      description: Internal Server Error
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'

    authorization_error:
      description: Unautorized
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        WWW-Authenticate:
          $ref: '#/components/headers/authenticate'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            bad_auth_data:
              value:
                error_code: 12010
                desc: Bad/incomplete input data
                detail: This resource needs 'Authorization' authorization headers
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12010
            wrong_login_password:
              value:
                error_code: 15014
                desc: Bad/incomplete input data
                detail: Login or password is incorrect
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-15014

    login_error:
      description: Unautorized
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        WWW-Authenticate:
          $ref: '#/components/headers/authenticate'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 15014
            desc: Bad/incomplete input data
            detail: Login or password is incorrect
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-15014

    cookies_not_found:
      description: Not Found
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 12013
            desc: Resource not found
            detail: Cookies for current session not found
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12013/

    forbidden_tasks_error:
      description: Forbidden, luna-tasks support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            tasks_disabled:
              value:
                error_code: 11039
                desc: Forbidden
                detail: Luna Tasks service is disabled
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11039
            lis_is_disabled:
              value:
                error_code: 11070
                desc: Forbidden
                detail: Luna Image Store service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11070"

    task_not_found_error:
      description: Not Found
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 28001
            desc: Object not found
            detail: Task with id '55023' not found
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28001

    server_timeout_error:
      description: server timeout error.
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            allOf:
              - $ref: '#/components/schemas/Error'
            example:
              error_code: 9
              detail: Request timeout
              desc: Request timeout on http://127.0.0.1:5010/{...}, method {...}
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-9

    tasks_403_errors:
      description: Access to this resource on the server is denied
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            events_is_disabled:
              value:
                error_code: 11040
                desc: Forbidden
                detail: Luna Events service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11040"
            lis_is_disabled:
              value:
                error_code: 11070
                desc: Forbidden
                detail: Luna Image Store service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11070"
            tasks_is_disabled:
              value:
                error_code: 11039
                desc: Forbidden
                detail: Luna Tasks service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11039"

    tasks_disabled:
      description: Access to this resource on the server is denied
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            tasks_is_disabled:
              value:
                error_code: 11039
                desc: Forbidden
                detail: Luna Tasks service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11039"

    ae_not_implemented:
      description: not implemented.
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            not_implemented:
              value:
                error_code: 12029
                desc: Functionality is not implemented
                detail: Required server functionality is not implemented
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12029
  securitySchemes:
    BasicAuth:
      type: http
      scheme: basic
paths:
  /:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account info tables
      description: account info form. if authorization is not passed redirection to */login* page occurs
      operationId: homeForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: all accounts info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /version/view:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: view version
      description: version form.
      operationId: versionForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: version info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /version:
    get:
      tags:
        - version

      summary: get version
      description: get versions of luna service
      operationId: getVersion

      parameters:
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version_handler_response'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/luna_sys_info:
    get:
      security:
        - BasicAuth: []
      tags:
        - help

      summary: get system info
      description: get luna system info
      operationId: getSystemInfo

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Disposition:
              $ref: '#/components/headers/content_disposition'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/system_info'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /login:
    get:
      tags:
        - views

      summary: log in
      description: authorization form. if authorization is passed redirection to home page occurs
      operationId: loginForm

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: login page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/login_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/login:
    get:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: check authorization
      description: check authorization cookie
      operationId: checkLogin

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        201:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_plain'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/plain:
              schema:
                type: string
              example: Ok
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    post:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: set authorization
      description: set authorization cookie
      operationId: setLogin

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        201:
          description: Created
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    patch:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: change authorization
      description: change authorization cookie
      operationId: changePassword

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_password'

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12002
                desc: Bad/incomplete input data
                detail: Request does not contain json
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12002
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

    delete:
      security:
        - BasicAuth: []
      tags:
        - login

      summary: clear authorization
      description: clear authorization cookie
      operationId: clearLogin

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          $ref: '#/components/responses/cookies_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/search:
    get:
      security:
        - BasicAuth: []
      tags:
        - search

      summary: search element by id or email
      description: search element by id or email
      operationId: search

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/search_parameter'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/search_response'
              examples:
                account_search:
                  value:
                    data:
                      info:
                        account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                        email: horns@hooves.com
                        organization_name: Horns and Hooves
                      stats:
                        list_count: 1
                        face_count: 1
                        face_attribute_count: 1
                    type: account
                  summary: found account info.
                list_search:
                  value:
                    data:
                      list_id: a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                      account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                      last_update_time: "2018-07-11T09:11:41.674Z"
                      face_count: 1
                      user_data: good persons
                    type: list
                  summary: found list info.
                face_search:
                  value:
                    data:
                      face_id: a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                      account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                      create_time: "2018-07-11T09:11:41.674Z"
                    type: face
                  summary: found face info.
                attribute_search:
                  value:
                    data:
                      attribute_id: a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                      account_id: 557d54ec-29ad-4f3c-93b4-c9092ef12515
                      gender: 1
                      age: 23
                      ethnicity: 1
                      descriptor:
                      create_time: "2018-07-11T09:11:41.674Z"
                    type: atttribute
                  summary: found attribute info.
                not_found:
                  value:
                    data: null
                    type: null
                  summary: element not found.
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /accounts:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account info tables
      description: account info form
      operationId: accountsForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: all accounts info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /accounts/{account_id}:
    parameters:
    - in: path
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: account id

    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account info by id
      description: specified account info form
      operationId: accountForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: account page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /accounts/{account_id}/lists:
    parameters:
    - in: path
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: account id

    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get account lists
      description: specified account lists form
      operationId: accountListsForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: account list page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/accounts:
    get:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: get accounts
      description: get accounts with filters
      operationId: getAccounts

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'page'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'

    post:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: register account
      description: |
        register a new account in the system.
        
        > **WARNING**: Account registering with `email` is deprecated. Create accounts with `login` & `password` instead.
        When creating an account using legacy scheme, the `email` field will be used as `login` & `password`, and the `organization_name` field will be used as account `description`.
        Mind the validation errors.

      operationId: registerAccount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/registered_account'
        required: true
      responses:
        201:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                example: /3/accounts/00000000-0000-4000-a000-000000027552
              required: true
              description: location of a new account
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/new_account_id'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: |
                      Failed to validate input json. Path: 'email', message: 'email must match pattern ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        409:
          description: Conflict
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 41002
                desc: Unique constraint error
                detail: Account with account_id '00000000-0000-4000-a000-000000027552' already exists
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41002
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/accounts/{account_id}:
    parameters:
    - in: path
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: account id

    get:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: get account by id
      description: get account info by account id
      operationId: getAccount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/account_info'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: Not Found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 15012
                desc: Object not found
                detail: An account with id '00000000-0000-4000-a000-000000025516' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-15012
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: put account by id
      description: |
        register a new account with specified id in the system.
        
        > **WARNING**: Account registering with `email` is deprecated. Create accounts with `login` & `password` instead.
        When creating an account using legacy scheme, the `email` field will be used as `login` & `password`, and the `organization_name` field will be used as account `description`.
        Mind the validation errors.

      operationId: putAccount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/registered_account'
        required: true
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Location:
              schema:
                type: string
                example: /3/accounts/00000000-0000-4000-a000-000000027552
              required: true
              description: location of a new account

          content:
            application/json:
              schema:
                $ref: '#/components/schemas/new_account_id'

        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'

          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: |
                  Failed to validate input json. Path: 'email', message: 'email must match pattern ^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,4})$'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        409:
          description: Conflict
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'

          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 41002
                desc: Unique constraint error
                detail: Account with account_id '00000000-0000-4000-a000-000000027552' already exists
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-41002
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      security:
        - BasicAuth: []
      tags:
        - accounts

      summary: remove account by id
      description: remove the account with specified id from the system
      operationId: removeAccount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/lists:
    get:
      security:
        - BasicAuth: []
      tags:
        - lists

      summary: get lists
      description: get lists with filters
      operationId: getLists

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/account_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/lists/{list_id}:
    parameters:
    - in: path
      name: list_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: list id

    get:
      security:
        - BasicAuth: []
      tags:
        - lists

      summary: get list
      description: get list info by id
      operationId: getListById

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/list_info'
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          description: Not Found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 22003
                desc: Object not found
                detail: List with id '00000000-0000-4000-a000-000000025516' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /tasks:
    get:
      security:
        - BasicAuth: []
      tags:
        - views

      summary: get task info tables
      description: task info form
      operationId: tasksForm

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                title: Visionlabs
                type: string
                description: all tasks info page.
              example: <html><body>some content</body></html>
        401:
          $ref: '#/components/responses/authorization_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get tasks
      description: get tasks with filters
      operationId: getTasks

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/task_ids'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'
        - $ref: '#/components/parameters/end_time__lt'
        - $ref: '#/components/parameters/end_time__gte'
        - $ref: '#/components/parameters/task_type'
        - $ref: '#/components/parameters/task_status'
        - $ref: '#/components/parameters/schedule_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_response'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/count:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task count
      description: get task count
      operationId: getTaskCount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/task_ids'
        - $ref: '#/components/parameters/create_time__lt'
        - $ref: '#/components/parameters/create_time__gte'
        - $ref: '#/components/parameters/end_time__lt'
        - $ref: '#/components/parameters/end_time__gte'
        - $ref: '#/components/parameters/task_type'
        - $ref: '#/components/parameters/task_status'
        - $ref: '#/components/parameters/schedule_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_count'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task by id
      description: get task by id with filters
      operationId: getTask

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_reply'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

    patch:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: cancel task by id
      description: cancel task by id with filters
      operationId: cancelTask

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 28019
                desc: Bad/incomplete input data
                detail: Task '55023' with status 5 cannot be canceled
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28019
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

    delete:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: delete task by id
      description: delete task by id
      operationId: deleteTask

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        204:
          description: No Content
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 28019
                desc: Bad/incomplete input data
                detail: Task '55023' with status 5 cannot be canceled
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28019
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'

  /4/tasks/{task_id}/result:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task result by id
      description: get task result by id
      operationId: getTaskResult

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_result'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: Not Found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 28020
                desc: Object not found
                detail: Impossible get a result of task 33804 with status 2
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28020
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}/errors:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task errors by task id
      description: get task errors by task id
      operationId: getTaskErrors

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_errors'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: Not Found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 28003
                desc: Object not found
                detail: Task error with id '33804' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}/errors/count:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get task error count by task id
      description: get task error count by task id
      operationId: getTaskErrorsCount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/error_time__lt'
        - $ref: '#/components/parameters/error_time__gte'
        - $ref: '#/components/parameters/error_code'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_count'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: Not Found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 28003
                desc: Object not found
                detail: Task error with id '33804' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/{task_id}/subtasks:
    parameters:
    - in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get subtasks by task id
      description: get subtasks by task id
      operationId: getTaskSubTasks

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/subtasks_reply'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        404:
          $ref: '#/components/responses/task_not_found_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/errors:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get errors
      description: get errors
      operationId: getErrors

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'
        - $ref: '#/components/parameters/task_ids'
        - $ref: '#/components/parameters/error_ids'
        - $ref: '#/components/parameters/error_time__lt'
        - $ref: '#/components/parameters/error_time__gte'
        - $ref: '#/components/parameters/task_type'
        - $ref: '#/components/parameters/error_code'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_errors'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/errors/count:
    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get error count
      description: get error count
      operationId: getErrorCount

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/task_ids'
        - $ref: '#/components/parameters/error_ids'
        - $ref: '#/components/parameters/error_time__lt'
        - $ref: '#/components/parameters/error_time__gte'
        - $ref: '#/components/parameters/task_type'
        - $ref: '#/components/parameters/error_code'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/error_count'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'task_ids'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/errors/{error_id}:
    parameters:
    - in: path
      name: error_id
      schema:
        $ref: '#/components/schemas/error_id'
      required: true
      description: error id

    get:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: get error by id
      description: get error by id
      operationId: getError

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/task_error'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12012
                desc: Bad/incomplete input data
                detail: Bad query parameters 'account_id'
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        404:
          description: Not Found
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 28003
                desc: Object not found
                detail: Task error with id '1042177' not found
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28003
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/gc:
    post:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: create gc task
      description: create and start gc task
      operationId: createTaskGC

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/gc_task'
        required: true

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: task id.
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: "Failed to validate input json. Path: '',  message: 'Additional properties are not allowed ('userdata' was unexpected)'"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/additional_extract:
    post:
      security:
        - BasicAuth: []
      tags:
        - tasks

      summary: create additional extract task
      description: create and start additional extract task
      operationId: createTaskAdditionalExtract

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/additional_extract_task'
        required: true

      responses:
        202:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: task id.
                properties:
                  task_id:
                    $ref: '#/components/schemas/task_id'
        400:
          description: Bad Request
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              example:
                error_code: 12022
                desc: Bad/incomplete input data
                detail: "Failed to validate input json. Path: '',  message: 'Additional properties are not allowed ('userdata' was unexpected)'"
                link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/forbidden_tasks_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /4/tasks/schedules:
    post:
      tags:
      - schedules

      summary: create tasks schedule
      description: |
        Create a new task schedule.

        Execution of scheduled tasks will be regulated according to the trigger and optionally starts one task 
        immediately (see *start_immediately* parameter in *behavior* section)

        No task from the schedule will be executed if the previous task has not yet been completed

      operationId: createSchedule

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/schedule'
        required: true

      responses:
        201:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  schedule_id:
                    $ref: '#/components/schemas/schedule_id'
                required:
                - schedule_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/tasks_403_errors'
        500:
          $ref: '#/components/responses/internal_server_error'
        501:
          $ref: '#/components/responses/ae_not_implemented'
        504:
          $ref: '#/components/responses/server_timeout_error'

    get:
      tags:
      - schedules

      summary: get tasks schedules
      description: get tasks schedules with filters
      operationId: getTasksSchedules

      parameters:
      - $ref: '#/components/parameters/authorization'
      - $ref: '#/components/parameters/exclude_header'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - $ref: '#/components/parameters/task_type_schedulable'
      - $ref: '#/components/parameters/create_time__lt'
      - $ref: '#/components/parameters/create_time__gte'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedules_reply'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/tasks_disabled'
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/tasks/schedules/{schedule_id}:
    parameters:
      - $ref: '#/components/parameters/schedule_id_path'

    get:
      tags:
      - schedules

      summary: get tasks schedule
      description: get tasks schedule
      operationId: getTasksSchedule

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/schedule_reply'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/tasks_disabled'
        404:
          description: object not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                object_not_found:
                  value:
                    error_code: 28040
                    desc: Object not found
                    detail: Schedule with id '12345' not found'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28040
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      tags:
      - schedules

      summary: replace tasks schedule
      description: |
        Replace tasks schedule:
        
        - if any task created by old schedule is running, it will be cancelled
        
        - schedule parameters will be replaced with the new ones
        
        - tasks will be executed according to the new schedule
      operationId: putTasksSchedule

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'

      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/schedule'
        required: true

      responses:
        200:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  schedule_id:
                    $ref: '#/components/schemas/schedule_id'
                required:
                  - schedule_id
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/tasks_403_errors'
        404:
          description: object not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                object_not_found:
                  value:
                    error_code: 28040
                    desc: Object not found
                    detail: Schedule with id '12345' not found'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28040
        500:
          $ref: '#/components/responses/internal_server_error'
        501:
          $ref: '#/components/responses/ae_not_implemented'

    patch:
      tags:
      - schedules

      summary: patch tasks schedule
      description: pause/start tasks schedule
      operationId: patchTasksSchedule

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/schedule_patch'

      responses:
        204:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/tasks_403_errors'
        404:
          description: object not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                object_not_found:
                  value:
                    error_code: 28040
                    desc: Object not found
                    detail: Schedule with id '12345' not found'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28040
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - schedules

      summary: delete tasks schedule
      description: delete tasks schedule
      operationId: deleteTasksSchedule

      parameters:
        - $ref: '#/components/parameters/authorization'
        - $ref: '#/components/parameters/exclude_header'
        - $ref: '#/components/parameters/luna_request_id'

      responses:
        204:
          description: OK
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        400:
          description: bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
        401:
          $ref: '#/components/responses/authorization_error'
        403:
          $ref: '#/components/responses/tasks_disabled'
        404:
          description: object not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                object_not_found:
                  value:
                    error_code: 28040
                    desc: Object not found
                    detail: Schedule with id '12345' not found'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-28040
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/docs/spec:
    get:
      tags:
        - documents
      summary: get openapi documentation
      description: |
        Get service OpenApi documentation. If *Accept* request header is of type `application/x-yaml`,
        returns documentation in `yaml` format or returns `html` documentation, if *Accept-Type* is `text/html`
      operationId: getSpec

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_docs_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/docs_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/x-yaml:
              schema:
                type: string
                description: yaml format documentation
            text/html:
              schema:
                type: string
                description: html format documentation
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: Bad/incomplete input data
                    desc: Unsupported media type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12024
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/docs/dev:
    get:
      tags:
        - documents
      summary: get development manual
      description: |
        Get sphinx documentation - *Development Manual*. After the request you will be redirected to the page `/docs/dev/index.html`
      operationId: getDevManual

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/text_html'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/html:
              schema:
                type: string
                description: html format documentation
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/config:
    get:
      tags:
        - config
      summary: get service configuration
      description: Get service configuration. Passwords and tokens will be hidden in the response.
      operationId: getConfig

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_config_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/config_accept_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: json format configuration
              example:
                INFLUX_MONITORING:
                  SEND_DATA_FOR_MONITORING: 0
                  VERSION: 2
                  ORGANIZATION: ORGANIZATION_NAME
                  TOKEN: '********'
                  BUCKET: luna_monitoring
                  HOST: 127.0.0.1
                  PORT: 8086
                  USE_SSL: 0
                  FLUSHING_PERIOD: 1.0
            text/plain:
              schema:
                type: string
                description: text format configuration
              example: |
                [INFLUX_MONITORING]
                SEND_DATA_FOR_MONITORING = 0
                VERSION = 2
                ORGANIZATION = ORGANIZATION_NAME
                TOKEN = ********
                BUCKET = luna_monitoring
                HOST = 127.0.0.1
                PORT = 8086
                USE_SSL = 0
                FLUSHING_PERIOD = 1.0
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: Bad/incomplete input data
                    desc: Unsupported media type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12024
        500:
          $ref: '#/components/responses/internal_server_error'
  /4/healthcheck:
    get:
      tags:
        - health
      summary: get health
      description: get health of service
      operationId: healthcheck
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/include_luna_services'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_ok'
        500:
          $ref: '#/components/responses/internal_server_error'
        502:
          description: Unhealthy
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_errors'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /healthcheck:
    get:
      tags:
        - health
      summary: get health (redirect)
      description: get health of service (redirect)
      operationId: healthcheck(redirect)
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/include_luna_services'
      responses:
        200:
          description: OK (redirected)
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_ok'
        308:
          description: Moved permanently
          headers:
            Location:
              schema:
                type: string
                enum:
                  - "/6/healthcheck"
              required: true
              description: redurect to the versioned resource
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          $ref: '#/components/responses/internal_server_error'

        502:
          description: Unhealthy (redirected)
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/health_errors'
        504:
          $ref: '#/components/responses/server_timeout_error'
security:
  - BasicAuth: []
