OpenApi for tasks_worker Luna Tasks service

View spec in html.

openapi: 3.0.0
info:
  version: 'v.3.9.3'
  title: 'Luna tasks-worker'
  description: 'VisionLabs Luna Tasks Worker'

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

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

    application_zip:
      schema:
        type: string
        enum:
        - application/zip
      required: true
      description: content type is application/zip

    content_disposition:
      schema:
        type: string
      example: 'attachment; filename=task_146.zip'
      required: true
      description: content disposition with filename

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

    image_jpeg:
      schema:
        type: string
        enum:
        - image/jpeg
      description: content type is image/jpeg
      required: true

    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

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

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

    config_accept_content_type:
      schema:
        type: string
        enum:
          - application/json
          - text/plain
      required: false
      description: The content type of the response body.
  parameters:
    page:
      in: query
      name: page
      schema:
        type: integer
        minimum: 1
        default: 1
      description: a page number.

    luna_request_id:
      in: header
      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: |
        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

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

    applicationJsonContent:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
        - application/json
      description: content type is application/json.

    create_time__lt:
      in: query
      name: create_time__lt
      schema:
        type: string
        format: date-time
      description: upper bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    create_time__gte:
      in: query
      name: create_time__gte
      schema:
        type: string
        format: date-time
      description: lower included bound for object create_time.
      example: "2018-08-11T09:11:41.674Z"

    end_time__lt:
      in: query
      name: end_time__lt
      schema:
        type: string
        format: date-time
      description: upper bound for object end_time.
      example: "2018-08-11T09:11:41.674Z"

    end_time__gte:
      in: query
      name: end_time__gte
      schema:
        type: string
        format: date-time
      description: lower included bound for object end_time.
      example: "2018-08-11T09:11:41.674Z"

    error_time__lt:
      in: query
      name: error_time__lt
      schema:
        type: string
        format: date-time
      description: upper bound for object error_time.
      example: "2018-08-11T09:11:41.674Z"

    error_time__gte:
      in: query
      name: error_time__gte
      schema:
        type: string
        format: date-time
      description: lower included bound for object error_time.
      example: "2018-08-11T09:11:41.674Z"

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

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

    subtask_status:
      in: query
      name: subtask_status
      schema:
        $ref: '#/components/schemas/subtask_status'
      example: 2

    account_id:
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      description: account id.
      example: 7daa0e35-36a2-474a-8f2b-87f78b59d080

    result_id:
      in: query
      name: result_id
      schema:
        $ref: '#/components/schemas/uuid'
      description: id of task result, which stored in luna-image store.
      example: 8f4f0070-c464-460b-bf78-fac225df72e9

    error_ids:
      in: query
      name: error_ids
      schema:
        $ref: '#/components/schemas/errorIds'
      description: error ids

    error_id_uri:
      in: path
      name: error_id
      schema:
        $ref: '#/components/schemas/error_id'
      required: true
      description: error id
      example: 10

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

    task_id_uri:
      in: path
      name: task_id
      schema:
        $ref: '#/components/schemas/task_id'
      required: true
      description: task id

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

    status_code:
      in: query
      name: status_code
      schema:
        $ref: '#/components/schemas/status_code'
      description: status code

    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
  schemas:
    Error:
      type: object
      properties:
        error_code:
          type: integer
          description: Error code.
        desc:
          type: string
          description: Short error description.
        detail:
          type: string
          description: Error details.
        link:
          type: string
          description: Link to the documentation website with the error description.
      required: [error_code, detail, desc, link]
      example:
        error_code: 1
        detail: Internal server error
        desc: Internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-1

    error_code:
      type: integer
      description: error code.

    error_link:
      type: string
      description: Link to the documentation website with the error description.

    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

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

    int0100:
      type: integer
      minimum: 0
      maximum: 100

    string36:
      type: string
      maxLength: 36

    image_origin:
      type: string
      maxLength: 256
      description: the image url - source of the detection
      nullable: true

    tags:
      description: tag array.
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/string36'
      example: ["tag1", "tag2"]

    error_id:
      type: integer
      example: 10

    errorIds:
      type: string
      format: comma-separate task ids
      minItems: 1
      example: 4,5,6

    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 |

    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 |

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

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

    task_account_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      description: account id of the task
      example: '346a5645-ec89-4806-820a-dbcb6e0dc381'

    task_count:
      type: object
      properties:
        count:
          type: integer
          minimum: 0
          example: 152
          description: tasks count

    error_count:
      type: object
      properties:
        count:
          type: integer
          minimum: 0
          example: 101
          description: errors count

    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 |

    int_version:
      type: integer
      minimum: 0

    task_ids:
      type: string
      format: comma-separate task ids
      description: task ids.
      example: 1,2,3

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

    task_content:
      type: object
      description: content of task
      example: content

    subtask_content:
      type: object
      description: content of subtask
      example: content
      additionalProperties: true

    objects_type:
      type: string
      description: objects type - faces or events
      enum: ["faces", "events"]
      example: "events"

    common_objects_type:
      type: string
      description: objects type - faces, attributes or events
      enum: ["faces", "events", "attributes"]

    error_description:
      type: string
      description: 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'

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

    count_task_parts_done:
      type: integer
      minimum: 0
      description: count of task finished parts
      example: 10

    count_task_parts_all:
      type: integer
      minimum: 1
      description: count of task parts
      example: 100

    status_code:
      type: integer
      minimum: 400
      maximum: 599
      description: error status code
      example: 500

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

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

    task_id:
      type: integer
      minimum: 1
      description: task id
      example: 123

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

    time:
      description: time in rfc3339 format
      type: string
      format: date-time
      example: "2021-07-28T01:23:21.537604+03:00"

    detect_ts:
      type: number
      minimum: 0.0
      maximum: 158731466399.999
      description: user-defined timestamp relative to something, such as the start of a video
      example: 123.456
      nullable: true

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

    tasks_reply:
      type: object
      description: tasks container
      properties:
        tasks:
          type: array
          description: found tasks
          items:
            $ref: '#/components/schemas/task_reply'

    limit:
      description: Maximum number of matching candidates to return for every match.
      type: integer
      minimum: 1
      example: 3
      default: 5

    clustering_limit:
      allOf:
      - $ref: '#/components/schemas/limit'
      maximum: 20000
      default: 20000

    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_nullable'
          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]

    subtasks_reply:
      description: Subtasks of a current task.
      type: object
      properties:
        subtasks:
          type: array
          items:
            $ref: '#/components/schemas/subtask_in_reply'

    task_error:
      type: object
      properties:
        error_id:
          $ref: '#/components/schemas/error_id'
        task_id:
          $ref: '#/components/schemas/task_id'
        subtask_id:
          $ref: '#/components/schemas/subtask_id'
        error_code:
          $ref: '#/components/schemas/error_code'
        link:
          $ref: '#/components/schemas/error_link'
        description:
          $ref: '#/components/schemas/error_description'
        detail:
          $ref: '#/components/schemas/error_detail'
        additional_info:
          $ref: '#/components/schemas/errors_additional_info'
        error_time:
          allOf:
          - $ref: '#/components/schemas/time'
          description: error time
      required: [error_id, task_id, subtask_id, error_code, link, description, detail, error_time]

    task_errors:
      type: array
      items:
        $ref: '#/components/schemas/task_error'
      maxItems: 100000
      description: |
        done task errors. Max error count is setting in the service configuration file. This limitation is applied at the moment when the
        task creates result.

    task_handler_errors:
      type: array
      items:
        $ref: '#/components/schemas/Error'
      minItems: 0
      description: image processing errors in handlers

    float10:
      type: number
      format: float
      minimum: 0
      maximum: 1

    face_ids:
      description: face ids
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/uuid'
      example: ['8950722f-3fd4-4223-b48f-03f95f0e8dfb', '346a5645-ec89-4806-820a-dbcb6e0dc381']

    attribute_ids:
      description: attribute ids
      type: array
      items:
        $ref: '#/components/schemas/uuid'
      minItems: 1
      example: ['8950722f-3fd4-4223-b48f-03f95f0e8dfb', '346a5645-ec89-4806-820a-dbcb6e0dc381']

    external_id:
      description: user-defined external id for face.
      type: string
      maxLength: 36
      example: "2xQ2gprbMUePw1s9gw9fvA=="

    external_ids:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/external_id'
      description: list of external ids. Each event from result will contain one of the given external ids.
      example: ['8950722f-3fd4-4223-b48f-03f95f0e8dfb', '346a5645-ec89-4806-820a-dbcb6e0dc381']

    user_data:
      description: user data.
      type: string
      maxLength: 128
      example: "100-00-12"

    face_id__gte:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: face id lower included boundary

    face_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: face id upper excluded boundary

    descriptor_info:
      type: object
      description: descriptor object filter
      properties:
        type:
          type: string
          description: descriptor type
          enum: ["face", "body"]
          default: "face"
      required: [type]

    faces_filters_no_account:
      type: object
      properties:
        face_ids:
          $ref: '#/components/schemas/face_ids'
        external_ids:
          $ref: '#/components/schemas/external_ids'
        user_data:
          $ref: '#/components/schemas/user_data'
        create_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
          description: create time lower including boundary.
          example: "2018-08-11T09:11:41.674Z"
        create_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
          description: create time upper excluding boundary.
          example: "2018-08-11T09:11:41.674Z"
        face_id__gte:
          $ref: '#/components/schemas/face_id__gte'
        face_id__lt:
          $ref: '#/components/schemas/face_id__lt'
        list_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: list id.
          example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'

    faces_filters_no_account_limited:
      allOf:
        - $ref: '#/components/schemas/faces_filters_no_account'
      properties:
        face_ids:
          maxItems: 20000
        external_ids:
          maxItems: 1000

    faces_filters:
      allOf:
        - $ref: '#/components/schemas/faces_filters_no_account'
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [ account_id ]

    faces_filters_limited:
      allOf:
      - $ref: '#/components/schemas/faces_filters_no_account_limited'
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [account_id]

    attributes_filters_no_account:
      type: object
      properties:
        attribute_ids:
          $ref: '#/components/schemas/attribute_ids'
      required: [attribute_ids]

    attributes_filters_no_account_limited:
      allOf:
      - $ref: '#/components/schemas/attributes_filters_no_account'
      type: object
      properties:
        attribute_ids:
          minItems: 1
          maxItems: 20000


    geo_position:
      type: object
      description: |
        geo position filter is bounding box specified by coordinates of its center (origin) and some delta.
        WARNING: boxes with a vertex or border on the International Date Line (IDL) or the North or South pole are
        not fully supported due to features of database spatial index - filter result may be unexpected.
        NOTE: highly recommended for citywide use only.
      properties:
        origin_longitude:
          $ref: '#/components/schemas/longitude'
        origin_latitude:
          $ref: '#/components/schemas/latitude'
        longitude_delta:
          type: number
          minimum: 0
          maximum: 90
          default: 0.01
          example: 0.1
          description: |
            longitude delta in degrees.
            WARNING: boxes with a vertex or border on the International Date Line (IDL) or the North or South pole
            are not fully supported due to features of database spatial index - filter result may be unexpected.
            Box edges more than 180 degrees long are not allowed. Boundaries of valid range are **exclusive**. NOTE: highly recommended for citywide use only.
        latitude_delta:
          type: number
          minimum: 0
          maximum: 90
          default: 0.01
          example: 0.1
          description: |
            latitude delta in degrees.
            WARNING: boxes with a vertex or border on the International Date Line (IDL) or the North or South pole
            are not fully supported due to features of database spatial index - filter result may be unexpected.
            Box edges more than 180 degrees long are not allowed. Boundaries of valid range are **exclusive**. NOTE: highly recommended for citywide use only.
      required: [origin_longitude, origin_latitude]

    label:
      type: string
      maxLength: 36
      description: matching label
      example: "matching_label"

    event_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      description: event ID.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    event_id__gte:
      allOf:
        - $ref: '#/components/schemas/event_id'
      description: event id lower included boundary

    event_id__lt:
      allOf:
        - $ref: '#/components/schemas/event_id'
      description: event id upper excluded boundary

    events_filters_no_account:
      type: object
      properties:
        create_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
          description: create time lower including boundary.
          example: "2018-08-11T09:11:41.674Z"
        create_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
          description: create time upper excluding boundary.
          example: "2018-08-11T09:11:41.674Z"
        end_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
          description: end time lower including boundary.
          example: "2018-08-11T09:11:41.674Z"
        end_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
          description: end time upper excluding boundary.
          example: "2018-08-11T09:11:41.674Z"
        sources:
          description: sources. Each event from result will contain one of the given sources.
          type: array
          minItems: 1
          items:
            type: string
          example: ["cam1", "cam2"]
        event_ids:
          description: events ids
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/event_id'
          example: ['8950722f-3fd4-4223-b48f-03f95f0e8dfb', '346a5645-ec89-4806-820a-dbcb6e0dc381']
        event_id__gte:
          $ref: '#/components/schemas/event_id__gte'
        event_id__lt:
          $ref: '#/components/schemas/event_id__lt'
        external_ids:
          $ref: '#/components/schemas/external_ids'
        handler_ids:
          description: handler ids. Each event from result will contain one of the given handlers.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/uuid'
          example: ['8950722f-3fd4-4223-b48f-03f95f0e8dfb', '346a5645-ec89-4806-820a-dbcb6e0dc381']
        top_matching_candidates_label:
          type: string
          maxLength: 36
          description: top matching candidate label
          example: "matching_label"
        top_similar_object_ids:
          description: ids of the most similar object.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/uuid'
          example: ['8950722f-3fd4-4223-b48f-03f95f0e8dfb', '346a5645-ec89-4806-820a-dbcb6e0dc381']
        top_similar_external_ids:
          description: external ids of the most similar objects.
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/external_id'
          example: ['external_id_1', 'external_id_2']
        top_similar_object_similarity__gte:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: the lower including boundary of the most similar face similarity.
          example: 0.5
        top_similar_object_similarity__lt:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: the upper excluding boundary of the most similar face similarity.
        age__lt:
          description: the upper excluding boundary of age.
          type: integer
          minimum: 0
          maximum: 100
          example: 50
        age__gte:
          description: the lower including boundary of age.
          type: integer
          minimum: 0
          maximum: 100
          example: 50
        gender:
          $ref: '#/components/schemas/gender'
        emotions:
          description: |
            list of predominant emotions. Each event from result will contain one of the given emotions.

            | emotions    | value |
            |-----------------|---|
            | anger           | 1 |
            | disgust         | 2 |
            | fear            | 3 |
            | happiness       | 4 |
            | neutral         | 5 |
            | sadness         | 6 |
            | surprise        | 7 |
          type: array
          minItems: 1
          items:
            type: integer
            enum: [1, 2, 3, 4, 5, 6, 7]
          example: [1, 2, 3]
        ethnic_groups:
          description: |
            list of dominant ethnic group. Each event from result will contain one of the given ethnic groups.

            | ethnicity   | value |
            |-----------------|---|
            | AfricanAmerican | 1 |
            | Indian          | 2 |
            | Asian           | 3 |
            | Caucasian       | 4 |
          type: array
          minItems: 1
          items:
            type: integer
            enum: [1, 2, 3, 4]
          example: [1, 2]
        face_ids:
          $ref: '#/components/schemas/face_ids'
        user_data:
          $ref: '#/components/schemas/user_data'
        tags:
          allOf:
            - $ref: '#/components/schemas/tags'
          description: list of tags. Each event from result will contain all of the given tags.
        cities:
          description: comma-separated list of cities. Each event from result will contain one of the given cities in location.
          type: array
          minItems: 1
          items:
            type: string
          example: ["moscow", "New-York"]
        areas:
          description: comma-separated list of areas. Each event from result will contain one of the given areas in location.
          type: array
          minItems: 1
          items:
            type: string
          example: ["CAO", "central park"]
        districts:
          description: comma-separated list of districts. Each event from result will contain one of the given districts in location.
          type: array
          minItems: 1
          items:
            type: string
          example: ["mitino", "central park"]
        streets:
          description: comma-separated list of streets. Each event from result will contain one of the given streets  in location.
          type: array
          minItems: 1
          items:
            type: string
          example: ["arbat", "schepkina"]
        house_numbers:
          description: comma-separated list of house numbers. Each event from result will contain one of the given house numbers in location.
          type: array
          minItems: 1
          items:
            type: string
          example: ["1", "1/2str3"]
        geo_position:
          $ref: '#/components/schemas/geo_position'
        masks:
          description: |
            list of mask states. Each event from result will contain one of the given mask states.

            | masks      | value |
            |----------------|---|
            | missing        | 1 |
            | medical_mask   | 2 |
            | occluded       | 3 |
          type: array
          minItems: 1
          items:
            type: integer
            enum: [1, 2, 3]
          example: [2, 3]
        track_ids:
          type: array
          minItems: 1
          description: list of track ids. Each event from result will contain one of the given track ids.
          items:
            type: string
            pattern: '^[a-zA-Z0-9_\-]{1,36}$'
          example: ["track_id_number_1", "track_id_number_2"]
        liveness:
          type: array
          minItems: 1
          description: |
            list of predominant liveness. Each event from result will contain one of the given liveness.

            | liveness | value |
            |--------------|---|
            | spoof        | 0 |
            | real         | 1 |
            | unknown      | 2 |
          items:
            type: integer
            enum: [0, 1, 2]
          example: [1, 2]
        apparent_gender:
          type: array
          minItems: 1
          items:
            type: integer
            enum: [ 0, 1, 2 ]
          description: |
            List of apparent gender: 0 - female, 1 - male, 2 - undefined. Each event from result will contain one of the given states.
          example: [0,1]
        apparent_age__lt:
          type: integer
          minimum: 0
          maximum: 100
          description: Apparent age upper excluded bound.
          example: 50
        apparent_age__gte:
          type: integer
          minimum: 0
          maximum: 100
          description: Apparent age lower included bound.
          example: 50
        headwear_states:
          type: array
          minItems: 1
          items:
            type: integer
            enum: [ 0, 1, 2 ]
          description: |
            List of headwear states: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.
          example: [0,1]
        sleeve_lengths:
          type: array
          minItems: 1
          items:
            type: string
            enum: [ short, long, undefined ]
          description: |
            List of sleeve length states. Each event from result will contain one of the given states.
          example: [short,long]
        upper_clothing_colors:
          type: array
          minItems: 1
          items:
            type: string
            enum: [ black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored, undefined ]
          description: |
            List of upper clothing colors. Each event from result will contain at least one of the given clothing colors.
          example: [black,white]
        backpack_states:
          type: array
          minItems: 1
          items:
            type: integer
            enum: [ 0, 1, 2 ]
          description: |
            List of backpack states: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.
          example: [1,2]

    events_filters_no_account_limited:
      allOf:
      - $ref: '#/components/schemas/events_filters_no_account'
      properties:
        event_ids:
          maxItems: 20000
        handler_ids:
          maxItems: 1000
        external_ids:
          maxItems: 1000
        top_similar_object_ids:
          maxItems: 1000
        top_similar_external_ids:
          maxItems: 1000
        face_ids:
          maxItems: 1000
        sources:
          maxItems: 1000
        cities:
          maxItems: 1000
        areas:
          maxItems: 1000
        districts:
          maxItems: 1000
        streets:
          maxItems: 1000
        house_numbers:
          maxItems: 1000
        track_ids:
          maxItems: 1000

    events_filters:
      allOf:
      - $ref: '#/components/schemas/events_filters_no_account'
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [ account_id ]

    events_filters_limited:
      allOf:
      - $ref: '#/components/schemas/events_filters_no_account_limited'
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [ account_id ]


    face_filters:
      description: face filters.
      type: object
      properties:
        account_id:
            $ref: '#/components/schemas/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.

    linker_task_content_both:
      type: object
      description: linker task content
      properties:
        create_list:
          description: create list to link faces to or not | require list_id or create_list set to 1
          type: integer
          enum: [0, 1]
          example: 1
        list_id:
          description: id of list to link faces to | require list_id or create_list set to 1
          allOf:
          - $ref: '#/components/schemas/uuid'
        user_data:
          allOf:
          - $ref: '#/components/schemas/user_data'
          description: user data to create the list with | works if create_list set to 1
        objects_type:
          $ref: '#/components/schemas/objects_type'
        filters:
          anyOf:
          - $ref: '#/components/schemas/faces_filters'
          - $ref: '#/components/schemas/events_filters'
      required: [objects_type, filters]

    linker_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          description: provided user data for current task
          example: linker task one
        content:
          $ref: '#/components/schemas/linker_task_content_both'
      required: [account_id, content]

    new_handler_task_estimator:
      type: object
      description: new handler with policies
      properties:
        description:
          type: string
          maxLength: 128
          description: user description.
          default: estimator_task_{task_id}
        policies:
          description: handler policies.
          type: object
          additionalProperties:
            x-additionalPropertiesName: new handler policies fields
            description: See the Luna Handlers documentation section for details - "creating a handler".
      required: [policies]

    existing_handler_task_estimator:
      type: object
      description: existing handler
      properties:
        handler_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: |
           handler_id of static or dynamic handler.

           An error will occur if policies are specified for static handlers.
        policies:
          description: handler policies (required for dynamic handler).
          type: object
          additionalProperties:
            x-additionalPropertiesName: handler policies fields
            description: See the Luna Handlers documentation section for details - "creating a handler".
      required: [ handler_id ]

    base_estimator_task_content_source:
      type: object
      properties:
        image_type:
          type: integer
          enum: [0,1,2]
          default: 0
          description: image type of input image.  0 - raw image, 1 - face warped image, 2 - body warped image
      required: [source_type]

    base_estimator_task_content_source_required:
      allOf:
        - $ref: '#/components/schemas/base_estimator_task_content_source'
        - required: [image_type, source_type]

    zip_password_authorization:
      type: object
      description: password authorization
      properties:
        password:
          type: string
          maxLength: 128
          description: user password for the archive (zip archive support now)

    estimator_authorization_by_password:
      type: object
      description: user authorization meta
      properties:
        source_type:
          type: string
          enum: ["zip"]
          description: data type where images are located
        reference:
          type: string
          description: archive location url
          format: uri
        authorization:
          $ref: '#/components/schemas/zip_password_authorization'
      required: [reference]

    estimator_source_with_option_zip:
      allOf:
        - $ref: '#/components/schemas/estimator_authorization_by_password'
        - $ref: '#/components/schemas/base_estimator_task_content_source'

    estimator_source_with_option_network_disk:
      allOf:
        - $ref: '#/components/schemas/estimator_mounted_network_path'
        - $ref: '#/components/schemas/base_estimator_task_content_source'

    estimator_source_with_option_ftp:
      allOf:
        - $ref: '#/components/schemas/estimator_ftp_server_data'
        - $ref: '#/components/schemas/base_estimator_task_content_source'

    estimator_source_with_option_zip_required:
      allOf:
        - $ref: '#/components/schemas/estimator_authorization_by_password'
        - $ref: '#/components/schemas/base_estimator_task_content_source_required'

    estimator_source_with_option_network_disk_required:
      allOf:
        - $ref: '#/components/schemas/estimator_mounted_network_path_required'
        - $ref: '#/components/schemas/base_estimator_task_content_source_required'

    estimator_source_with_option_ftp_required:
      allOf:
        - $ref: '#/components/schemas/estimator_ftp_server_data_required'
        - $ref: '#/components/schemas/base_estimator_task_content_source_required'

    prefix_schema:
      type: string
      description: |
        file key prefix, also can be used to download from specific folder

        example file tree and prefixes
        ```
        .
        ├── prefix
        │   ├── 123_file.jpg
        │   └── file2.jpg
        ├── temp_file.jpg
        └── prefix_file.jpg
        ```

        | prefix        | result files                                           |
        |---------------|--------------------------------------------------------|
        | prefix        | prefix/file2.jpg, prefix/123_file.jpg, prefix_file.jpg |
        | prefix/       | prefix/file2.jpg, prefix/123_file.jpg                  |
        | prefix/123    | prefix/123_file.jpg                                    |
        | temp          | temp_file.jpg                                          |

    postfix_schema:
      type: string
      description: |
        file key postfix, also can be used to download files with specific extension

        example file tree and postfixes
        ```
        .
        ├── dir
        │   ├── face1.jpg
        │   └── face2.png
        ├── temp_file.png
        └── file.jpg
        ```

        | postfix       | result files                          |
        |---------------|---------------------------------------|
        | .jpg          | dir/face1.jpg, file.jpg               |
        | .png          | dir/face2.png, temp_file.png          |

    ftp_reference:
      type: object
      description: ftp server reference
      properties:
        host:
          type: string
          description: ftp server host (IP or hostname)
        port:
          type: integer
          description: ftp server port
          minimum: 1
          maximum: 65535
          default: 21
        user:
          type: string
          description: ftp server user
          default: anonymous
        password:
          type: string
          description: ftp server password
          default: anonymous
        max_sessions:
          type: integer
          description: maximum number of allowed FTP sessions on server
          minimum: 1
          maximum: 50
          default: 8
        path:
          type: string
          description: path to directory with images
        prefix:
          $ref: '#/components/schemas/prefix_schema'
        postfix:
          $ref: '#/components/schemas/postfix_schema'
      required: [host]

    ftp_reference_required:
      allOf:
        - $ref: '#/components/schemas/ftp_reference'
        - required: [host, port, user, password, max_sessions, path]

    ftp_authorization:
      type: object
      description: FTP authorization
      properties:
        user:
          type: string
          description: ftp server user
          default: anonymous
        password:
          type: string
          description: ftp server password
          default: anonymous
      required: [user, password]

    estimator_ftp_server_data:
      type: object
      description: ftp server
      properties:
        source_type:
          type: string
          enum: ["ftp"]
          description: data type where images are located
        reference:
          $ref: '#/components/schemas/ftp_reference'
        authorization:
          $ref: '#/components/schemas/ftp_authorization'
        recursive:
          type: boolean
          default: true
          description: whether to estimate images from ftp subdirectories recursively
      required: [reference]

    estimator_ftp_server_data_required:
      allOf:
        - $ref: '#/components/schemas/estimator_ftp_server_data'
        - properties:
            reference:
              $ref: '#/components/schemas/ftp_reference_required'
        - required: [source, type, reference, recursive]

    network_disk_reference:
      type: object
      description: network disk reference
      properties:
        path:
          type: string
          description: absolute mounted directory path
        prefix:
          $ref: '#/components/schemas/prefix_schema'
        postfix:
          $ref: '#/components/schemas/postfix_schema'
        follow_links:
          type: boolean
          default: false
          description: whether follow file system links
      required: [path]

    estimator_mounted_network_path:
      type: object
      description: mounted network disk
      properties:
        source_type:
          type: string
          enum: ["network_disk"]
          description: Network disk source must be configured properly. See luna-tasks development manual for more information
        reference:
          $ref: '#/components/schemas/network_disk_reference'
        recursive:
          type: boolean
          default: true
          description: whether to estimate images from bucket subdirectories recursively
      required: [reference]

    estimator_mounted_network_path_required:
      allOf:
        - $ref: '#/components/schemas/estimator_mounted_network_path'
        - required: [source_type, reference, recursive]

    s3_reference:
      type: object
      description: s3-like storage reference
      properties:
        endpoint:
          type: string
          description: storage endpoint
          format: uri
        bucket_name:
          type: string
          description: |
            one of the following options:<ul>
            <li>raw bucket name (in this case, `endpoint` must be specified)</li>
            <li>access point ARN (in this case, `endpoint` and `region` must not be specified)
            (see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-access-points.html">aws userguide</a> for details)</li>
            <li>outpost ARN (in this case, `endpoint` and `region` must not be specified)
            (see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/S3onOutposts.html">aws userguide</a> for details)</li>
            </ul>
        prefix:
          type: string
          description: |
            file key prefix, also can be used to download from specific folder
            (see <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/using-prefixes.html"> aws userguide</a> for details)
        region:
          type: string
          description: bucket region
      required: [bucket_name]

    s3_authorization:
      type: object
      description: s3-like authorization
      properties:
        public_access_key:
          type: string
          description: public access key
        secret_access_key:
          type: string
          description: secret access key
        signature_version:
          type: string
          enum: [ s3v2, s3v4 ]
          default: s3v4
          description: authorization signature version
      required: [public_access_key, secret_access_key]

    s3_authorization_required:
      allOf:
        - $ref: '#/components/schemas/s3_authorization'
        - required: [public_access_key, secret_access_key, signature_version]

    estimator_authorization_s3_like_storage:
      type: object
      description: s3-like storages auth data
      properties:
        source_type:
          type: string
          enum: ["s3"]
          description: data type where images are located
        reference:
          $ref: '#/components/schemas/s3_reference'
        authorization:
          $ref: '#/components/schemas/s3_authorization'
        recursive:
          type: boolean
          default: true
          description: whether to estimate images from bucket subdirectories recursively
        save_origin:
          type: boolean
          default: true
          description: whether to save image origin
      required: [reference]

    estimator_authorization_s3_like_storage_required:
      allOf:
        - $ref: "#/components/schemas/estimator_authorization_s3_like_storage"
        - properties:
            reference:
              $ref: '#/components/schemas/s3_reference'
            authorization:
              $ref: '#/components/schemas/s3_authorization_required'
        - required: [source_type, reference, recursive, save_origin]

    estimator_source_with_option_s3bucket:
      allOf:
        - $ref: '#/components/schemas/estimator_authorization_s3_like_storage'
        - $ref: '#/components/schemas/base_estimator_task_content_source'

    estimator_source_with_option_s3bucket_required:
      allOf:
        - $ref: '#/components/schemas/estimator_authorization_s3_like_storage_required'
        - $ref: '#/components/schemas/base_estimator_task_content_source_required'

    estimator_task_content_handler:
      description: |
        handler for estimator task.

        You can create a new static handler and specify policies for it or specify an existing static or dynamic handler. For the existing dynamic handler, you can specify policies.

        The same dynamic handler can be used in different estimator tasks, and it is not required to create a new handler for each task.
      oneOf:
        - $ref: '#/components/schemas/new_handler_task_estimator'
        - $ref: '#/components/schemas/existing_handler_task_estimator'

    estimator_task_content_filters:
      type: object
      description: estimator filters
      properties:
        account_id:
          $ref: '#/components/schemas/account_id'
      required: [account_id]

    estimator_task_content_source:
      description: images source
      oneOf:
        - $ref: '#/components/schemas/estimator_source_with_option_zip'
        - $ref: '#/components/schemas/estimator_source_with_option_s3bucket'
        - $ref: '#/components/schemas/estimator_source_with_option_network_disk'
        - $ref: '#/components/schemas/estimator_source_with_option_ftp'
      discriminator:
        propertyName: "source_type"
        mapping:
          zip: '#/components/schemas/estimator_source_with_option_zip'
          s3: '#/components/schemas/estimator_source_with_option_s3bucket'
          network_disk: '#/components/schemas/estimator_source_with_option_network_disk'
          ftp: '#/components/schemas/estimator_source_with_option_ftp'

    estimator_task_content_source_required:
      description: images source
      oneOf:
        - $ref: '#/components/schemas/estimator_source_with_option_zip_required'
        - $ref: '#/components/schemas/estimator_source_with_option_s3bucket_required'
        - $ref: '#/components/schemas/estimator_source_with_option_network_disk_required'
        - $ref: '#/components/schemas/estimator_source_with_option_ftp_required'
      discriminator:
        propertyName: "source_type"
        mapping:
          zip: '#/components/schemas/estimator_source_with_option_zip_required'
          s3: '#/components/schemas/estimator_source_with_option_s3bucket_required'
          network_disk: '#/components/schemas/estimator_source_with_option_network_disk_required'
          ftp: '#/components/schemas/estimator_source_with_option_ftp_required'

    estimator_task_content:
      type: object
      description: estimator task content
      properties:
        handler:
          $ref: '#/components/schemas/estimator_task_content_handler'
        source:
          $ref: '#/components/schemas/estimator_task_content_source'
        filters:
          $ref: '#/components/schemas/estimator_task_content_filters'
      required: [handler, source, filters]

    estimator_task_content_required:
      type: object
      description: estimator task content
      properties:
        handler:
          $ref: '#/components/schemas/estimator_task_content_handler'
        source:
          $ref: '#/components/schemas/estimator_task_content_source_required'
        filters:
          $ref: '#/components/schemas/estimator_task_content_filters'
      required: [handler, source, filters]

    estimator_task:
      type: object
      description: estimator task object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          description: provided user data for current task.
          example: estimator task one
        content:
          $ref: '#/components/schemas/estimator_task_content'
      required: [account_id, content]

    gc_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          default: ""
          description: provided user data for current task.
          example: gc task one
        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'
          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'
      required: [account_id, content]

    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:
              description: version of descriptors to delete
              type: integer
          required: [descriptor_version]
        store_results:
          type: boolean
          description: Whether to store task results. Whatever, task errors are stored.
          default: true
      required: [target, filters]

    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:
          type: object
          properties:
            descriptor_version:
              description: Descriptors version.
              type: integer
            descriptor_type:
              description: Descriptors type.
              type: string
              enum: ['face', 'body']
          required: [descriptor_version, descriptor_type]
        store_results:
          type: boolean
          description: Whether to store task results. Whatever, task errors are stored.
          default: true
      required: [target, filters]

    gc_events_task_content:
      description: garbage collecting task content to remove events
      type: object
      properties:
        target:
          type: string
          enum: ['events']
        filters:
          type: object
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
              description: account id to execute task within the specified account.
            create_time__lt:
              allOf:
                - $ref: '#/components/schemas/time'
              description: create time upper excluding boundary.
            insert_time__lt:
              allOf:
                - $ref: '#/components/schemas/time'
              description: insert time upper excluding boundary.
            handler_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
              description: handler id to execute task within the handler.
        store_results:
          type: boolean
          description: Whether to store task results. Whatever, task errors are stored.
          default: true
        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 origin images.
            In case url of the image origin points to external image task tries to remove it by performing DELETE request to the image url.

            > **WARNING**: Some images may belong to multiple events simultaneously.

          default: false
      required: [target]

    clustering_task:
      anyOf:
        - $ref: '#/components/schemas/event_clustering_task'
        - $ref: '#/components/schemas/face_clustering_task'

    event_clustering_task_params:
      type: object
      description: additional task parameters
      properties:
        use_track_info:
          type: integer
          enum: [0, 1]
          default: 0
          description: whether to place events with equal track_id in the same clusters

    clustering_task_content_template:
      description: Clustering task content
      type: object
      properties:
        threshold:
          description: The minimum acceptable degree of similarity. If the similarity of two descriptors exceeds the specified value, it is considered that they belong to the same person. In this case, both descriptors are added to the same cluster.
          type: number
          format: float
          maximum: 1
          minimum: 0
          example: 0.5
          default: 0.81
        descriptor:
          $ref: '#/components/schemas/descriptor_info'
        limit:
          $ref: '#/components/schemas/clustering_limit'
      required: [objects_type, filters]

    clustering_task_template:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          description: provided user data for current task.
          example: clustering usefull faces
      required: [account_id, content]

    clustering_task_content_events:
      allOf:
        - $ref: '#/components/schemas/clustering_task_content_template'
      description: Events clustering task content
      properties:
        objects_type:
          enum: [ events ]
        filters:
          $ref: '#/components/schemas/events_filters_limited'
        params:
          $ref: '#/components/schemas/event_clustering_task_params'

    event_clustering_task:
      allOf:
        - $ref: '#/components/schemas/clustering_task_template'
      properties:
        content:
          $ref: '#/components/schemas/clustering_task_content_events'

    clustering_task_content_faces:
      allOf:
        - $ref: '#/components/schemas/clustering_task_content_template'
      description: Faces clustering task content
      properties:
        objects_type:
          enum: [ faces ]
        filters:
          $ref: '#/components/schemas/faces_filters_limited'

    face_clustering_task:
      allOf:
        - $ref: '#/components/schemas/clustering_task_template'
        - properties:
            content:
              $ref: '#/components/schemas/clustering_task_content_faces'

    clustering_task_content:
      description: Clustering task content
      oneOf:
        - $ref: '#/components/schemas/clustering_task_content_faces'
        - $ref: '#/components/schemas/clustering_task_content_events'
      discriminator:
        propertyName: objects_type
        mapping:
          faces: '#/components/schemas/clustering_task_content_faces'
          events: '#/components/schemas/clustering_task_content_events'

    ae_face_filters:
      description: face filters.
      type: object
      properties:
        objects_type:
          description: object type.
          type: string
          enum: [ "faces" ]
        account_id:
          $ref: '#/components/schemas/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:
      description: event filters.
      type: object
      properties:
        objects_type:
          description: object type.
          type: string
          enum: [ "events" ]
        account_id:
          $ref: '#/components/schemas/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.
        insert_time__gte:
          allOf:
            - $ref: '#/components/schemas/time'
          description: event insert time lower including boundary.
          example: "2018-08-11T09:11:41.674Z"
        insert_time__lt:
          allOf:
            - $ref: '#/components/schemas/time'
          description: event insert time upper excluding boundary.
          example: "2018-08-11T09:11:41.674Z"
      required: [ objects_type ]

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

    additional_extract_task_content_face_descriptor:
      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]
        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_basic_attributes:
      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
            descriptor_version:
              type: integer  # will be removed in LUNA-5160
        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, filters ]

    additional_extract_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          description: provided user data for current task.
          example: additional extract usefull faces
        content:
          description: additional extractor task content.
          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'
      required: [account_id, content]

    gc_descriptors_task_result:
      description: faces whoes descriptors was removed
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/uuid'
        description: face id whoes descriptor was removed

    gc_events_task_result:
      description: removed events
      type: array
      items:
        description: removed event
        type: object
        properties:
          event_id:
            description: removed event id.
            allOf:
              - $ref: '#/components/schemas/uuid'
          samples:
            description: sample ids of the removed face attribute from events.
            type: array
            items:
              $ref: '#/components/schemas/uuid'
          image_origins:
            description: removed image origins.
            type: array
            items:
              type: string
              example: '/6/images/557d54ec-29ad-4f3c-93b4-c9092ef12515'
        required: [event_id]

    gc_task_result:
      description: Garbage Collecting task result
      type: object
      properties:
        result:
          anyOf:
            - $ref: '#/components/schemas/gc_descriptors_task_result'
            - $ref: '#/components/schemas/gc_events_task_result'
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

    linker_task_result:
      description: Linking task result
      type: object
      properties:
        result:
          type: object
          description: linker task result
          properties:
            list_id:
              allOf:
              - $ref: '#/components/schemas/uuid'
              description: list id
            face_ids:
              description: linked faces' ids
              type: array
              items:
                $ref: '#/components/schemas/uuid'
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

    clustering_task_result:
      description: Clustering task result
      type: object
      properties:
        result:
          description: clustering result
          type: object
          properties:
            clusters:
              description: generated clusters - lists of objects ids
              type: array
              items:
                description: single cluster - list of objects' ids
                type: array
                items:
                  $ref: '#/components/schemas/uuid'
            total_objects:
              type: integer
              description: total objects count.
              example: 1
            total_clusters:
              type: integer
              description: total clusters count.
              example: 1
          required: [clusters, total_objects, total_clusters]
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

    landmark:
      type: array
      items:
        type: integer
      description: |
        key point coordinates. First element is `x` coordinate, second is `y`.
      minItems: 2
      maxItems: 2
      example: [ 12, 13 ]

    landmarks5:
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      description: array of 5 landmarks.
      minItems: 5
      maxItems: 5

    landmarks68:
      description: array of 68 landmarks.
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      minItems: 68
      maxItems: 68

    landmarks32:
      description: array of 32 landmarks.
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      minItems: 32
      maxItems: 32

    mouth_attributes:
      description: mouth attributes.
      type: object
      properties:
        score:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: mouth detection confidence.
        smile:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: smile probability.
        opened:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: opened mouth probability.
        occluded:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: occlusion probability.
      required: [ score, smile, occluded, opened ]

    eye_attributes:
      description: eye attributes.
      type: object
      properties:
        state:
          type: string
          enum: [ open, closed, occluded ]
          description: eye state.
        iris_landmarks:
          allOf:
            - $ref: '#/components/schemas/landmarks32'
            - description: iris landmarks.
      required: [ state, iris_landmarks ]

    eyes_attributes:
      description: eyes attributes.
      type: object
      properties:
        left_eye:
          allOf:
            - $ref: '#/components/schemas/eye_attributes'
            - description: left eye attributes.
        right_eye:
          allOf:
            - $ref: '#/components/schemas/eye_attributes'
            - description: right eye attributes.
      required: [ left_eye, right_eye ]

    head_pose:
      description: head pose.
      type: object
      properties:
        yaw:
          type: number
          description: yaw angle in degrees.
        pitch:
          type: number
          description: pitch angle in degrees.
        roll:
          type: number
          description: roll angle in degrees.
      required: [ yaw, pitch, roll ]

    gaze_direction:
      type: object
      properties:
        yaw:
          type: number
          description: yaw angle in degrees.
        pitch:
          type: number
          description: pitch angle in degrees.
      required: [ yaw, pitch ]

    emotions_estimations:
      type: object
      properties:
        anger:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: anger probability.
        disgust:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: disgust probability.
        fear:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: fear probability.
        happiness:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: happiness probability.
        neutral:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: neutral face probability.
        sadness:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: sadness probability.
        surprise:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: surprise probability.
      required: [ surprise, sadness, neutral, happiness, fear, disgust, anger ]
      description: emotion classifier response.

    emotions:
      type: object
      properties:
        estimations:
          allOf:
            - $ref: '#/components/schemas/emotions_estimations'
            - description: emotion classifier response.
        predominant_emotion:
          type: string
          description: name of predominant emotion.
          enum: [ surprise, sadness, neutral, happiness, fear, disgust, anger ]
      required: [ estimations, predominant_emotion ]

    mask_estimations:
      type: object
      description: raw mask estimations
      properties:
        medical_mask:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: The probability that the `medical mask` exists on the face and is worn properly
        missing:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: The probability that the `medical mask` doesn't exist on the face
        occluded:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: The probability that the face is occluded by other object (not by `medical mask`)
      required: [ medical_mask, missing, occluded ]

    mask_predominant:
      type: string
      enum: [ medical_mask, missing, occluded ]
      description: most likely mask state

    face_occlusion:
      type: object
      description: Estimated face occlusion.
      properties:
        predominant_occlusion:
          type: string
          enum: ["full", "clear", "correct", "partially", "mouth", "chin"]
          description: The most likely face occlusion state.
        estimations:
          type: object
          description: Raw face occlusion estimations scores.
          properties:
            full:
              allOf:
              - $ref: '#/components/schemas/float10'
              description: The probability that the mask occlude whole face.
            clear:
              allOf:
              - $ref: '#/components/schemas/float10'
              description: The probability that the mask absent.
            correct:
              allOf:
              - $ref: '#/components/schemas/float10'
              description: The probability that the mask is put on correctly.
            partially:
              allOf:
              - $ref: '#/components/schemas/float10'
              description: The probability that the mask is put on partially correct.
            mouth:
              allOf:
              - $ref: '#/components/schemas/float10'
              description: The probability that the mask is put on mouth only.
            chin:
              allOf:
              - $ref: '#/components/schemas/float10'
              description: The probability that the mask is put on chin only.
          required: [full, clear, correct, partially, mouth, chin]
      required: [predominant_occlusion, estimations]

    masks:
      type: object
      description: estimated face mask state
      properties:
        estimations:
          $ref: '#/components/schemas/mask_estimations'
        predominant_mask:
          $ref: '#/components/schemas/mask_predominant'
        face_occlusion:
          $ref: '#/components/schemas/face_occlusion'
      required: [ estimations, predominant_mask, face_occlusion]

    ethnicities_estimations:
      type: object
      description: ethnicity classifier response.
      properties:
        asian:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: Asian ethnicity probability.
        indian:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: Indian ethnicity probability.
        caucasian:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: Caucasian ethnicity probability.
        african_american:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: African American ethnicity probability.
      required: [ african_american, caucasian, indian, asian ]

    ethnicities:
      description: estimated ethnicities.
      type: object
      properties:
        estimations:
          allOf:
            - $ref: '#/components/schemas/ethnicities_estimations'
            - description: ethnicity classifier response.
        predominant_ethnicity:
          type: string
          description: name of predominant ethnicity.
      required: [ estimations, predominant_ethnicity ]

    liveness:
      type: object
      description: liveness prediction
      properties:
        prediction:
          type: string
          enum: [ spoof, real, unknown ]
          description: liveness prediction name
        estimations:
          type: object
          description: liveness estimations
          properties:
            quality:
              allOf:
                - $ref: '#/components/schemas/float10'
              description: liveness quality score
            score:
              allOf:
                - $ref: '#/components/schemas/float10'
              description: liveness prediction score
          required: [ quality, score ]
      required: [ prediction, estimations ]

    quality:
      description: |
        image quality. Estimation of image visual properties.
      type: object
      properties:
        dark:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: low value means under-exposured face area (i.e. due to backlight, poor lighting, sensor underexposure).
        light:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: low value means over-exposured face area (i.e. overbright lighting, sensor overexposure).
        illumination:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: low value means illumination nonuniformity.
        specularity:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: low value means low specularity.
        blurriness:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: low value means blurred image (e.g. due to depth of field or motion blur). High value means sharp image.
      required: [ blurriness, specularity, illumination, light, dark ]

    rect:
      description: bounding rectangle.
      type: object
      properties:
        height:
          type: integer
          description: rectangle height.
        width:
          type: integer
          description: rectangle width.
        x:
          type: integer
          description: top left corner "x" coordinate.
        y:
          type: integer
          description: top left corner "y" coordinate.
      required: [ height, width, x, y ]

    attributes:
      description: face attributes.
      type: object
      properties:
        mouth_attributes:
          allOf:
            - $ref: '#/components/schemas/mouth_attributes'
            - description: optional mouth attributes.
        eyes_attributes:
          allOf:
            - $ref: '#/components/schemas/eyes_attributes'
            - description: optional eye attributes.
        emotions:
          allOf:
            - $ref: '#/components/schemas/emotions'
            - description: face emotions estimation.
        mask:
          $ref: '#/components/schemas/masks'
        head_pose:
          allOf:
            - $ref: '#/components/schemas/head_pose'
            - description: head pose estimation.
        gaze:
          allOf:
            - $ref: '#/components/schemas/gaze_direction'
            - description: gaze direction estimation.
        liveness:
          $ref: '#/components/schemas/liveness'

    face_detection:
      type: object
      description: face detection
      properties:
        attributes:
          allOf:
            - $ref: '#/components/schemas/attributes'
            - description: face attributes estimation.
        quality:
          allOf:
            - $ref: '#/components/schemas/quality'
            - description: image quality estimation for this face detection region.
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: face detection bounding box.
        landmarks5:
          allOf:
            - $ref: '#/components/schemas/landmarks5'
            - description: facial landmarks.
        landmarks68:
          allOf:
            - $ref: '#/components/schemas/landmarks68'
            - description: facial landmarks.
        face_quality:
          type: object
          description: face quality estimations checks
          properties:
            status:
              type: integer
              enum: [ 0, 1 ]
              description: check status for all estimates
            checks:
              description: face quality container with all estimates
              type: object
              additionalProperties:
                x-additionalPropertiesName: face quality container with all estimates
                description: See the Luna Handlers documentation section for details - "generate events".
          required: [ status, checks ]

    body_detection:
      type: object
      description: body detection
      properties:
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: body detection bounding box.

    detection_filter_reason:
      type: object
      properties:
        filter_name:
          type: string
          enum: ['pitch_threshold', 'roll_threshold', 'yaw_threshold', 'score_threshold', 'mask_states', 'liveness_states',
                 'image_format', 'illumination_quality', 'specularity_quality', 'blurriness_quality', 'dark_quality',
                 'light_quality', 'head_yaw', 'head_pitch', 'head_roll', 'gaze_yaw', 'gaze_pitch', 'mouth_smiling',
                 'mouth_occluded', 'mouth_open', 'glasses', 'left_eye', 'right_eye', 'head_horizontal_center',
                 'head_vertical_center', 'head_width', 'head_height', 'eye_distance', 'image_width', 'image_height',
                 'aspect_ratio', 'face_width', 'face_height', 'indent_left', 'indent_right', 'indent_upper',
                 'eyebrows_state', 'smile_properties', 'headwear_type', 'natural_light', 'radial_distortion', 'red_eyes',
                 'face_color_type', 'indent_lower', 'image_size', 'illumination_uniformity', 'dynamic_range']
          description: filter name
        object_value:
          type: number
          description: estimate value
        threshold_value:
          oneOf:
            - type: number
              description: threshold value
            - type: array
              items:
                type: integer
              minItems: 1
              description: threshold values

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

    age:
      allOf:
        - $ref: '#/components/schemas/int0100'
        - description: Age

    basic_attributes:
      type: object
      description: basic attributes
      properties:
        age:
          $ref: '#/components/schemas/age'
        gender:
          $ref: '#/components/schemas/gender'
        ethnicities:
          $ref: '#/components/schemas/ethnicities'
      required: [ age, gender, ethnicities ]

    extractor_filter:
      type: object
      properties:
        is_filtered:
          type: boolean
          description: true if sample is filtered by a threshold otherwise false
        filter_reasons:
          type: array
          items:
            type: object
            properties:
              filter_name:
                type: string
                enum: ['score_threshold']
                description: filter name
              object_value:
                type: number
                description: estimate value
              threshold_value:
                type: number
                description: threshold value
            required:
            - filter_name
            - object_value
            - threshold_value
      description: extractor filters
    face_attribute:
      type: object
      properties:
        attribute_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/uuid'
            - description: attribute id, null if descriptor score is lower than score treshold
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: face descriptor quality score.
        url:
          nullable: true
          type: string
          format: uri-reference
          description: location of attributes, null if attribute was not stored
        samples:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/uuid'
              - description: sample id
          description: resource for attributes
        filter:
          $ref: '#/components/schemas/extractor_filter'
      required: [ attribute_id, url, samples ]

    body_attribute:
      type: object
      properties:
        score:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: |
            body descriptor quality score.
            > **WARNING** If body descriptor was extracted, the value is always set to 1.
        samples:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/uuid'
              - description: sample id
          description: stored attribute samples
      required: [ samples ]

    EventAggregateEstimations:
      type: object
      description: aggregated attributes estimated from samples.
      properties:
        face:
          type: object
          description: face aggregated estimations.
          properties:
            attributes:
              type: object
              description: estimated attributes.
              properties:
                liveness:
                  $ref: "#/components/schemas/liveness"
                emotions:
                  $ref: "#/components/schemas/emotions"
                mask:
                  $ref: "#/components/schemas/masks"
          required: [ attributes ]
        body:
          type: object
          description: Aggregated body estimations.
          properties:
            attributes:
              $ref: "#/components/schemas/body_attributes"
          required: [attributes]
      required: [face, body]

    base_face:
      type: object
      description: face object
      properties:
        face_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: face id.
        event_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/uuid'
            - description: event id associated with the face creation.
        user_data:
          description: user data assosiated with object.
          type: string
          maxLength: 128
          default: ""
        external_id:
          description: user-defined external id
          type: string
          default: ""
          maxLength: 36
        avatar:
          type: string
          format: uri-reference
          default: ""
          maxLength: 256
          description: avatar for the face, references to a sample or a user-defined reference.
        lists:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/uuid'
              - description: list id
          minItems: 0
          description: list of luna lists, which contain the face.

    event_face:
      description: handler generated face
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            account_id:
              $ref: '#/components/schemas/account_id'

    candidate_face:
      description: handler generated face
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            url:
              type: string
              description: created face location url
              format: uri-reference
            create_time:
              allOf:
                - $ref: '#/components/schemas/time'
                - description: create time

    event_face_detection:
      type: object
      description: saved with event face detection
      properties:
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: face detection bounding box.

    match_candidates_face_in_event_candidates_in_target_match_result:
      type: object
      properties:
        face:
          type: object
          properties:
            face_id:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/uuid'
                - description: face id
            user_data:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/user_data'
            create_time:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/time'
                - description: create time
            external_id:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/external_id'
        similarity:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: face candidate similarity
      required: [ face, similarity ]

    match_candidates_events_in_event_candidates_in_target_match_result:
      type: object
      description: event candidate object in the response
      properties:
        event:
          type: object
          properties:
            event_id:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/uuid'
                - description: event id
            user_data:
              allOf:
                - $ref: '#/components/schemas/user_data'
              default: ""
            create_time:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/time'
                - description: create time
            external_id:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/external_id'
            handler_id:
              allOf:
                - nullable: true
                - $ref: '#/components/schemas/uuid'
                - description: handler id
            source:
              type: string
              maxLength: 128
              description: some additional information that user provided with event
              nullable: true
        similarity:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: event candidate similarity
      required: [ event, similarity ]

    event_match_result:
      type: object
      description: saved event matches by a set of candidates
      properties:
        label:
          type: string
          description: label for matching candidates
          maxLength: 36
        candidates:
          anyOf:
            - type: array
              description: saved event matches by faces
              items:
                $ref: '#/components/schemas/match_candidates_face_in_event_candidates_in_target_match_result'
            - type: array
              description: saved event matches by events
              items:
                $ref: '#/components/schemas/match_candidates_events_in_event_candidates_in_target_match_result'
      required: [ label, candidates ]

    top_match_face:
      type: object
      properties:
        label:
          type: string
          description: top matching label
          maxLength: 36
        similarity:
          description: similarity to the most similar face.
          allOf:
            - $ref: '#/components/schemas/float10'
        face_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/uuid'
            - description: face id
        external_id:
          allOf:
          - $ref: '#/components/schemas/external_id'
          nullable: true
      required: [ label, similarity, face_id, external_id ]

    top_match_event:
      type: object
      properties:
        label:
          type: string
          description: top matching label
          maxLength: 36
        similarity:
          description: similarity to the most similar event.
          allOf:
            - $ref: '#/components/schemas/float10'
        event_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/uuid'
            - description: event id
        external_id:
          allOf:
          - $ref: '#/components/schemas/external_id'
          nullable: true
      required: [ label, similarity, event_id, external_id ]

    candidate_event:
      type: object
      description: event candidate object in the response
      properties:
        event_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: event id
        account_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: account id
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: time of the event creation.
        end_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: the end time of the event.
        external_id:
          allOf:
            - $ref: '#/components/schemas/external_id'
          default: ""
        handler_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: handler id
        source:
          type: string
          maxLength: 128
          nullable: true
          description: some additional information that user provided with event
        top_match:
          nullable: true
          description: top match result from match policy
          oneOf:
            - $ref: '#/components/schemas/top_match_face'
            - $ref: '#/components/schemas/top_match_event'
        match_result:
          type: array
          nullable: true
          description: saved event matches by faces or events
          items:
            $ref: '#/components/schemas/event_match_result'
        face_detections:
          nullable: true
          type: array
          items:
            type: object
            properties:
              sample_id:
                allOf:
                  - $ref: '#/components/schemas/uuid'
                  - description: sample id
              detection:
                type: object
                description: saved with event face detection
                properties:
                  rect:
                    allOf:
                      - $ref: '#/components/schemas/rect'
                      - description: face detection bounding box.
              detect_time:
                allOf:
                  - $ref: "#/components/schemas/time"
                  - description: detection time
              detect_ts:
                $ref: '#/components/schemas/detect_ts'
              image_origin:
                $ref: "#/components/schemas/image_origin"
            required: [ sample_id, detect_time, image_origin, detect_ts ]
        body_detections:
          nullable: true
          type: array
          items:
            type: object
            properties:
              sample_id:
                allOf:
                  - $ref: '#/components/schemas/uuid'
                  - description: sample id
              detection:
                $ref: '#/components/schemas/body_detection'
              detect_time:
                allOf:
                  - $ref: "#/components/schemas/time"
                  - description: detection time
              detect_ts:
                $ref: '#/components/schemas/detect_ts'
              image_origin:
                $ref: "#/components/schemas/image_origin"
            required: [ sample_id, detect_time, image_origin, detect_ts ]
        face_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/uuid'
            - description: face id
        attach_result:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/uuid'
              - description: list id
          nullable: true
        gender:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/gender'
        age:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/age'
        emotion:
          type: integer
          enum: [ 1,2,3,4,5,6,7 ]
          nullable: true
          description: list of emotion
        liveness:
          nullable: true
          type: integer
          enum: [ 0, 1, 2 ]
          description: list of liveness
        mask:
          nullable: true
          type: integer
          enum: [ 1, 2, 3 ]
          description: list of mask
        ethnic_group:
          type: integer
          enum: [ 1,2,3,4 ]
          nullable: true
          description: list of ethnic group
        tags:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/tags'
        user_data:
          allOf:
            - $ref: '#/components/schemas/user_data'
            - default: ""
        location:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/location'
        track_id:
          description: event track id
          type: string
          pattern: '^[a-zA-Z0-9_\-]{1,36}$'
          nullable: true

    face_detection_sample:
      type: object
      description: face detection sample
      properties:
        sample_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: sample id.
        detection:
          $ref: '#/components/schemas/face_detection'
        url:
          type: string
          nullable: true
          format: uri-reference
          description: location of the sample, null if sample was not stored
      required:
        - detection
        - sample_id
        - url

    body_detection_sample:
      type: object
      description: body detection sample
      properties:
        sample_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: sample id.
        detection:
          $ref: '#/components/schemas/body_detection'
        url:
          type: string
          nullable: true
          format: uri-reference
          description: location of the sample, null if sample was not stored
      required:
        - detection
        - sample_id
        - url

    event_detection_samples:
      type: object
      properties:
        filename:
          type: string
          description: source image file name
        samples:
          type: object
          description: body & face related samples that refer to the one person.
          properties:
            body:
              allOf:
                - $ref: '#/components/schemas/body_detection_sample'
                - nullable: true
            face:
              allOf:
                - $ref: '#/components/schemas/face_detection_sample'
                - nullable: true
          required: [ body, face ]
        detect_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: detection time
        detect_ts:
          $ref: '#/components/schemas/detect_ts'
        image_origin:
          $ref: "#/components/schemas/image_origin"
      required: [ filename, samples, detect_time, image_origin, detect_ts ]

    longitude:
      type: number
      minimum: -180
      maximum: 180
      description: longitude in degrees

    latitude:
      type: number
      minimum: -90
      maximum: 90
      description: latitude in degrees

    location_geo_position:
      type: object
      description: geo position specified by geographic coordinates - longitude and latitude.
      properties:
        longitude:
          $ref: '#/components/schemas/longitude'
        latitude:
          $ref: '#/components/schemas/latitude'
      required: [ longitude, latitude ]

    location:
      type: object
      description: information about a place where event is incidented
      properties:
        city:
          allOf:
            - $ref: '#/components/schemas/string36'
            - nullable: true
            - description: city
        area:
          allOf:
            - $ref: '#/components/schemas/string36'
            - nullable: true
            - description: area
        district:
          allOf:
            - $ref: '#/components/schemas/string36'
            - nullable: true
            - description: district
        street:
          allOf:
            - $ref: '#/components/schemas/string36'
            - nullable: true
            - description: street
        house_number:
          allOf:
            - $ref: '#/components/schemas/string36'
            - nullable: true
            - description: house number
        geo_position:
          allOf:
            - $ref: '#/components/schemas/location_geo_position'
            - nullable: true
            - description: geo coordinates

    candidate_match_result_face:
      type: object
      properties:
        similarity:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: face match similatrity.
        face:
          $ref: '#/components/schemas/candidate_face'
      description: match result for the event and a face.
      required: [ similarity, face ]

    candidate_match_result_event:
      type: object
      properties:
        similarity:
          allOf:
            - $ref: '#/components/schemas/float10'
            - description: event match similatrity.
        event:
          $ref: '#/components/schemas/candidate_event'
      description: sorted list with match result for the event and a event.
      required: [ similarity, event ]

    match_candidates_faces:
      type: object
      properties:
        label:
          description: top matching candidates label.
          type: string
          maxLength: 36
        candidates:
          type: array
          description: list of faces candidates
          items:
            $ref: '#/components/schemas/candidate_match_result_face'
      required: [ label, candidates ]

    match_candidates_events:
      type: object
      properties:
        label:
          description: top matching candidates label.
          type: string
          maxLength: 36
        candidates:
          type: array
          description: list of events candidates
          items:
            $ref: '#/components/schemas/candidate_match_result_event'
      required: [ label, candidates ]

    matches:
      description: sorted list with match result for the event.
      type: array
      items:
        anyOf:
          - $ref: '#/components/schemas/match_candidates_faces'
          - $ref: '#/components/schemas/match_candidates_events'

    event_from_handler:
      type: object
      description: event format from handler.
      properties:
        face_attributes:
          allOf:
            - description: extracted face attributes from samples.
            - $ref: '#/components/schemas/face_attribute'
            - nullable: true
        body_attributes:
          allOf:
            - description: extracted body attributes from samples.
            - $ref: '#/components/schemas/body_attribute'
            - nullable: true
        aggregate_estimations:
          $ref: '#/components/schemas/EventAggregateEstimations'
        source:
          type: string
          maxLength: 128
          description: some additional information that user provided with event
          nullable: true
        tags:
          $ref: '#/components/schemas/tags'
        external_id:
          allOf:
            - $ref: '#/components/schemas/external_id'
          default: ""
        user_data:
          allOf:
            - $ref: '#/components/schemas/user_data'
          default: ""
        face:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/event_face'
        event_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: Event id.
        url:
          type: string
          format: uri-reference
          description: location of event, null if event was not stored
          nullable: true
        matches:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/matches'
        location:
          $ref: '#/components/schemas/location'
        detections:
          description: list of body & face related detections
          type: array
          items:
            $ref: '#/components/schemas/event_detection_samples'
        track_id:
          description: event track id
          type: string
          pattern: '^[a-zA-Z0-9_\-]{1,36}$'
          nullable: true
      required: [ matches, url, event_id, face, tags, source, face_attributes, body_attributes, aggregate_estimations, location, user_data, external_id, detections, track_id ]

    success_estimator_result:
      description: Estimator task result
      type: array
      items:
        type: object
        properties:
          filename:
            type: string
            description: source image file name
          result:
            type: object
            description: image estimation result
            nullable: true
            properties:
              events:
                type: array
                items:
                  $ref: '#/components/schemas/event_from_handler'
              filtered_detections:
                type: object
                properties:
                  face_detections:
                    type: array
                    items:
                      type: object
                      properties:
                        filter_reasons:
                          type: array
                          items:
                            $ref: '#/components/schemas/detection_filter_reason'
                          minItems: 1
                        detection:
                          type: object
                          properties:
                            filename:
                              type: string
                              description: source image filename
                            sample:
                              type: object
                              description: detection sample
                              properties:
                                detection:
                                  $ref: '#/components/schemas/face_detection'
                              required: [ detection ]
                          required: [ filename, sample ]
                      required: [ filter_reasons, detection ]
                required: [ face_detections ]
            required: [events, filtered_detections]
          errors:
            $ref: '#/components/schemas/task_handler_errors'
        required: [filename, result, errors]

    estimator_task_result:
      type: object
      description: Estimator task result
      properties:
        result:
          $ref: '#/components/schemas/success_estimator_result'
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

    reporter_task_content:
      type: object
      description: reporter task content
      properties:
        filters:
          type: object
          description: reporter task filters
          properties:
            account_id:
              $ref: '#/components/schemas/account_id'
            task_id:
              description: id of task
              type: integer
              example: 146
          required: [task_id]
        columns:
          description: Column targets in CSV report. Order of fields determinates the order columns in report.
          anyOf:
            - $ref: '#/components/schemas/report_event_columns'
            - $ref: '#/components/schemas/report_face_columns'
          example: ["face_id", "user_data", "create_time"]
        csv_delimiter:
          default: ','
          type: string
          description: csv delimiter
          maxLength: 1
          minLength: 1
          example: '$'
        save_images:
          type: integer
          default: 0
          enum: [0, 1]
          description: whether to save images in the result
      required: [filters]

    report_event_columns:
      type: array
      items:
        description: |
          event columns
        type: string
        enum: ["create_time", "external_id", "handler_id", "source", "top_match", "match_result", "face_detections", "face_id", "attach_result", "gender",
               "age", "emotion", "ethnic_group", "tags", "user_data", "city", "area", "district", "street",
               "house_number", "geo_position", "body_detections", "mask", "track_id", "liveness", "end_time",
               "body_basic_attributes", "upper_body", "accessories",
               ]
      default: [ "create_time", "external_id", "handler_id", "source", "top_match", "match_result", "face_detections", "face_id", "attach_result", "gender",
                 "age", "emotion", "ethnic_group", "tags", "user_data", "city", "area", "district", "street",
                 "house_number", "geo_position", "body_detections", "mask", "track_id", "liveness", "end_time",
                 "body_basic_attributes", "upper_body", "accessories",
                 ]

    report_face_columns:
      type: array
      items:
        description: face columns.
        type: string
        enum: ["user_data", "create_time", "lists", "external_id", "avatar", "event_id"]
      default: ["user_data", "create_time", "external_id", "avatar", "event_id"]

    reporter_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          description: provided user data for current task
          example: report clasterization events from cam1
        content:
          $ref: '#/components/schemas/reporter_task_content'
      required: [account_id, content]

    exporter_event_columns:
      type: array
      items:
        description: |
          event columns. default is
          ["event_id", "create_time", "external_id", "handler_id", "source", "top_match", "match_result",
                         "face_detections", "face_id", "attach_result", "gender", "end_time",
                         "age", "emotion", "ethnic_group", "tags", "user_data", "city", "area", "district", "street",
                         "house_number", "geo_position", "body_detections", "mask", "track_id", "liveness"
                         "body_basic_attributes", "upper_body", "accessories",
          ]
        type: string
        enum: ["event_id", "create_time", "external_id", "handler_id", "source", "top_match", "match_result",
               "face_detections", "face_id", "attach_result", "gender", "end_time",
               "age", "emotion", "ethnic_group", "tags", "user_data", "city", "area", "district", "street",
               "house_number", "geo_position", "body_detections", "mask", "track_id", "liveness",
               "body_basic_attributes", "upper_body", "accessories",
               ]

    exporter_face_columns:
      type: array
      items:
        description: face columns. default is ["face_id", "user_data", "create_time", "external_id", "avatar", "event_id"]
        type: string
        enum: ["face_id", "user_data", "create_time", "lists", "external_id", "avatar", "event_id"]

    exporter_task_content:
      type: object
      description: exporter task content
      properties:
        objects_type:
          $ref: '#/components/schemas/objects_type'

        filters:
          description: exporter task filters
          anyOf:
            - $ref: '#/components/schemas/events_filters'
            - $ref: '#/components/schemas/faces_filters'

        columns:
          description: colum names in csv report. Order of fields determinates the order columns in report.
          anyOf:
            - $ref: '#/components/schemas/exporter_event_columns'
            - $ref: '#/components/schemas/exporter_face_columns'
          example: [ "face_id", "user_data", "create_time" ]

        descriptor:
          $ref: '#/components/schemas/descriptor_info'

        csv_delimiter:
          default: ','
          type: string
          description: csv delimiter
          maxLength: 1
          minLength: 1
          example: '$'

        save_images:
          type: integer
          default: 0
          enum: [ 0, 1 ]
          description: whether to add images to the resulting archive

      required: [ filters, objects_type ]

    exporter_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          $ref: '#/components/schemas/task_description'
        content:
          $ref: '#/components/schemas/exporter_task_content'

      required: [account_id, content]

    face_additional_extract_result:
      type: object
      properties:
        face_id:
          description: extracted attribute face id.
          allOf:
            - $ref: '#/components/schemas/uuid'
        samples:
          description: sample ids used for extraction
          type: array
          items:
            $ref: '#/components/schemas/uuid'
      required: [face_id, samples]

    event_additional_extract_result:
      type: object
      properties:
        event_id:
          description: extracted attribute event id.
          allOf:
            - $ref: '#/components/schemas/uuid'
        samples:
          description: sample ids used for extraction
          type: array
          items:
            $ref: '#/components/schemas/uuid'
      required: [event_id, samples]

    additional_extract_task_result:
      description: Additional extract task result
      type: object
      properties:
        result:
          description: additional extract result
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/event_additional_extract_result'
              - $ref: '#/components/schemas/face_additional_extract_result'
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

    cross_match_task_reference_filters:
      description: Object filters for references.
      anyOf:
        - $ref: '#/components/schemas/faces_filters_no_account_limited'
        - $ref: '#/components/schemas/events_filters_no_account_limited'
        - $ref: '#/components/schemas/attributes_filters_no_account_limited'

    cross_match_task_candidate_filters:
      description: Object filters for candidates.
      anyOf:
        - $ref: '#/components/schemas/faces_filters_no_account_limited'
        - $ref: '#/components/schemas/events_filters_no_account_limited'
        - $ref: '#/components/schemas/attributes_filters_no_account_limited'

    cross_match_task_content:
      type: object
      description: cross match task content
      properties:
        filters:
          description: Task objects' filters.
          type: object
          properties:
            reference_type:
              $ref: '#/components/schemas/common_objects_type'
            candidate_type:
              $ref: '#/components/schemas/common_objects_type'
            reference_filters:
              $ref: '#/components/schemas/cross_match_task_reference_filters'
            candidate_filters:
              $ref: '#/components/schemas/cross_match_task_candidate_filters'
            descriptor:
              $ref: '#/components/schemas/descriptor_info'
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
              description: account ID filter for task objects.
          required: [ reference_type, candidate_type, reference_filters, candidate_filters ]
        threshold:
          description: The minimum acceptable degree of similarity. If the similarity of two descriptors falls behind the specified value, the match will be ignored. References with all filtered matches also will be ignored.
          type: number
          format: float
          maximum: 1
          minimum: 0
          example: 0.5
          default: 0.0
        limit:
          $ref: '#/components/schemas/limit'
      required: [ filters ]

    cross_match_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          type: string
          description: provided user data for current task
          example: matching famous people with customers
        content:
          $ref: '#/components/schemas/cross_match_task_content'
      required: [account_id, content]

    cross_match_task_result:
      description: Cross Match task result
      type: object
      properties:
        result:
          description: cross match task result
          type: array
          items:
            type: object
            properties:
              reference_id:
                description: reference id (see reference_type field in cross_match_task filters).
                allOf:
                  - $ref: '#/components/schemas/uuid'
              candidates:
                description: match candidates for the reference
                type: array
                items:
                  type: object
                  description: match with a candidate
                  properties:
                    candidate_id:
                      description: candidate id (see candidate_type field in cross_match_task filters)
                      allOf:
                        - $ref: '#/components/schemas/uuid'
                    similarity:
                      description: similatrity for the reference-candidate pair
                      type: number
                      minimum: 0
                      maximum: 1
                      example: 1
                  required: [candidate_id, similarity]
                minItems: 1
            required: [reference_id, candidates]
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

    markup_face_items:
      type: object
      properties:
        face_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: face id.
        label:
          type: integer
          description: face label (group id)
          example: 12
      required: [face_id, label]

    markup_attribute_items:
      type: object
      properties:
        attribute_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: attribute id.
        label:
          type: integer
          description: face attribute label (group id)
          example: 12
      required: [attribute_id, label]

    roc_task_content:
      description: roc task content.
      type: object
      properties:
        markup:
          description: markup of face ids to labels (group ids).
          type: array
          minItems: 2
          maxItems: 20000
          items:
            oneOf:
              - $ref: '#/components/schemas/markup_face_items'
              - $ref: '#/components/schemas/markup_attribute_items'
        filters:
          description: task objects' filters.
          type: object
          properties:
            account_id:
              allOf:
                - $ref: '#/components/schemas/uuid'
              description: account id filter for a task objects.
        threshold_hit_top:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: similarity threshold to calculate hit into the top-N.
          example: 0.95
          default: 0
        limit:
          $ref: '#/components/schemas/limit'
        key_FPRs:
          description: roc-curve key FPR values
          type: array
          items:
            $ref: '#/components/schemas/float10'
          example: [ 0.000001, 0.001 ]
      required: [ markup, filters ]

    roc_task:
      type: object
      properties:
        account_id:
          $ref: '#/components/schemas/task_account_id'
        description:
          description: provided user data for current task.
          type: string
          example: matching famous people with customers
        content:
          $ref: '#/components/schemas/roc_task_content'

      required: [account_id, content]

    roc_points:
      type: object
      properties:
        FPR:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: false positive rate.
        TPR:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: true positive rate.
        similarity:
          allOf:
            - $ref: '#/components/schemas/float10'
          description: similatrity threshold.
      required: [FPR, TPR, similarity]

    roc_task_result:
      description: roc task result.
      type: object
      properties:
        result:
          description: roc-curve calculation result.
          type: object
          properties:
            roc:
              type: array
              items:
                $ref: '#/components/schemas/roc_points'
              description: roc-curve points.
              example:
               - FPR: 0.1
                 TPR: 0.95
                 similarity: 0.9
               - FPR: 0.15
                 TPR: 0.96
                 similarity: 0.8
            hit_top_probability:
              type: object
              description: propability of hit into the top.
              properties:
                top-1:
                  allOf:
                    - $ref: '#/components/schemas/float10'
                  description: propability of hit into the top-1.
                  nullable: true
                top-2:
                  allOf:
                    - $ref: '#/components/schemas/float10'
                  description: propability of hit into the top-2.
                  nullable: true
                top-3:
                  allOf:
                    - $ref: '#/components/schemas/float10'
                  description: propability of hit into the top-3.
                  nullable: true
                top-4:
                  allOf:
                    - $ref: '#/components/schemas/float10'
                  description: propability of hit into the top-4.
                  nullable: true
                top-5:
                  allOf:
                    - $ref: '#/components/schemas/float10'
                  description: propability of hit into the top-5.
                  nullable: true
              required: [top-1, top-2, top-3, top-4, top-5]
              example:
                top-1: 0.995
                top-2: 0.997
                top-3: 0.999
                top-4: 0.999
                top-5: 0.999
            auc:
              allOf:
                - $ref: '#/components/schemas/float10'
              description: area under the roc-curve.
              example: 0.99
            type_I_and_II_error_rates_equal_point:
              allOf:
                - $ref: '#/components/schemas/roc_points'
              description: ROC-curve point where type I error rate (1 - TPR) and type II error rate (FPR) are equal, i.e. intersection point of the ROC-curve and the secondary main diagonal.
              example:
                FPR: 0.15
                TPR: 0.85
                similarity: 0.8
              nullable: true
            key_points:
              type: array
              items:
                $ref: '#/components/schemas/roc_points'
              description: roc-curve points.
              example:
                - FPR: 0.000001
                  TPR: 0.95
                  similarity: 0.9
                - FPR: 0.001
                  TPR: 0.96
                  similarity: 0.8
              nullable: true
          required: [roc, hit_top_probability, auc, type_I_and_II_error_rates_equal_point, key_points]
        errors:
          $ref: '#/components/schemas/task_errors'
      required: [errors]

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

    report_task_result:
      type: string
      format: binary
      description: |
        zip archive with task result (now zip is supported in tasks on reports).

        Csv file and optional a folder with images in the case clusterization report.

        | cluster | event_id                             | create_time                      | end_time                         | external_id | handler_id                           | attribute_id                         | source | top_match                                                                                                                                      | face_id                              | gender | age | emotion | ethnic_group | user_data                         | city   | area | district | street | house_number | latitude | longitude | mask | apparent_gender | apparent_age | headwear_state | sleeve_length | upper_clothing_colors | backpack_state |
        |---------|--------------------------------------|----------------------------------|----------------------------------|-------------|--------------------------------------|--------------------------------------|--------|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|--------|-----|---------|--------------|-----------------------------------|--------|------|----------|--------|--------------|----------|-----------|------|-----------------|--------------|----------------|---------------|-----------------------|----------------|
        | 0       | 6a4053de-17ab-40b5-bf2b-a1495df39085 | 2019-02-13T18:04:40.723800+03:00 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | b3f9e82d-1654-4250-b39e-f8bbbca9880c |        | "{'face_id': '23978f64-305f-4c43-8c01-c40bafabe554', 'label': '3a118ebc-18e2-4ed0-a0f0-3a50db652729', 'similarity': 0.6, 'external_id': 'e0'}" | cfb8ca11-4901-4296-a71d-0783d61ccf05 | 1      | 28  |         | 2            | vl test events_with_created_faces | Moscow | CAA  | Arbat    | Arbat  | 1            | 12.34    |   56.78   |  1   | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 1       | 110cc2d3-0350-418e-b956-90ef4dacbd23 | 2019-02-13T18:04:40.723800+03:00 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 3e1d0ffb-1fa6-449e-8c8b-8f9b56bfff6d |        | "{'face_id': 'ad008886-942c-4c13-934c-8232dc7eefb2', 'label': '15859afa-37d3-41e2-8bc2-cb6f970dc6a0', 'similarity': 0.5, 'external_id': 'e1'}" | f4f17cbe-9197-4347-b214-692fa4ca9f26 | 0      | 24  |         | 2            | vl test events_with_created_faces | Moscow | CAA  | Arbat    | Arbat  | 1            | 12.34    |   56.78   |  1   | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 2       | 9a9c9445-6a3d-4f4d-b22a-64601f4c8675 | 2019-02-13T18:04:40.723800+03:00 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 91a7fd34-0877-46f5-844c-e88fd28d68f0 |        | "{'face_id': 'c77bda6b-74ea-412f-989f-f27fd5be1e20', 'label': '3ac8c676-c717-4da4-8ed3-6ca9e6139c6d', 'similarity': 0.4, 'external_id': 'e2'}" | 83086070-bce2-40b9-a5c4-9df36a52fe4f | 0      | 19  |         | 4            | vl test events_with_created_faces | Moscow | CAA  | Arbat    | Arbat  | 1            | 12.34    |   56.78   |  1   | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 2       | 979be9cd-6363-431a-a8a6-3f3fff806abf | 2019-02-13T18:04:40.723800+03:00 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 2cfacb32-fc7a-4abd-8518-0bf759acc4f9 |        | "{'face_id': '477a4ef7-16dc-4189-ab3b-91b1d342e101', 'label': '64058eac-eff1-4efc-b6c3-982133523a31', 'similarity': 0.3, 'external_id': 'e3'}" | e09228a7-8a7e-4581-b550-d5c0818c871f | 0      | 28  |         | 4            | vl test events_with_created_faces | Moscow | CAA  | Arbat    | Arbat  | 1            | 12.34    |   56.78   |  1   | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 3       | 60b86bf7-3395-40cf-90f0-4e0756f50b9e | 2019-02-13T18:04:40.723800+03:00 | 2019-02-13T18:04:40.723800+03:00 |             | d727b3f5-e8ca-4fca-b092-d170ef5f9e49 | 67c823db-8e3c-4638-abf9-63078d2687d5 |        | "{'face_id': '7f5bf6fb-2ad0-42bf-98f2-fe949516db7d', 'label': 'be309d4d-deaa-479e-ba70-026a712f39e2', 'similarity': 0.2, 'external_id': 'e4'}" | 301e8eb8-b6af-4c33-b5a1-6861509d2df4 | 1      | 56  |         | 4            | vl test events_with_created_faces | Moscow | CAA  | Arbat    | Arbat  | 1            | 12.34    |   56.78   |  1   | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |

    export_task_result:
      type: string
      format: binary
      description: |
        zip archive with task result (now zip is supported in tasks on export).

        Csv file and optional a folder with images in the case export.

        | event_id                             | create_time                      | end_time                         | external_id                          | handler_id                           | source                               | top_match                                                                                                                                      | face_id                              | gender | age | emotion | ethnic_group | user_data                            | mask | track_id                             | city   | area | district | street | house_number | geo_position     | mask | apparent_gender | apparent_age | headwear_state | sleeve_length | upper_clothing_colors | backpack_state |
        |--------------------------------------|----------------------------------|----------------------------------|--------------------------------------|--------------------------------------|--------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------|--------|-----|---------|--------------|--------------------------------------|------|--------------------------------------|--------|------|----------|--------|--------------| -----------------|------|-----------------|--------------|----------------|---------------|-----------------------|----------------|
        | 0370f6b6-643a-4ad6-8c30-57849d7b070d | 2021-06-18T09:01:45.115401+03:00 | 2021-06-18T09:01:45.115401+03:00 | a2c4ef84-8ed6-4b9c-b4ac-b96e7ae4d973 | 0f474053-8b2c-4d62-bfd0-b2f6072464cd | a7f009a9-3a98-4e5b-8e45-0c43290c84df | "{'face_id': '23978f64-305f-4c43-8c01-c40bafabe554', 'label': '3a118ebc-18e2-4ed0-a0f0-3a50db652729', 'similarity': 0.6, 'external_id': 'e0'}" | f687a4d1-0d25-4940-bbda-192b7b964fed | 1      | 33  | 7       | 1            | 1111632d-70fc-4e2e-b336-d5a68e1deb14 | 1    | 09e6642b-1ebe-405d-9bcd-86bbe254dc4f | Moscow | CAA  | Arbat    | Arbat  | 1            | "55.752, 36.616" | 1    | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 0370f6b6-643a-4ad6-8c30-57849d7b070c | 2021-06-18T09:01:45.115206+03:00 | 2021-06-18T09:01:45.115401+03:00 | 2ba4dcb3-0ca6-43b2-a588-42cd776a09ab | 2daa17f1-a5e6-4d7b-bae4-a224eec35eee | c038bede-f002-4c74-98fe-d3686b043fcd | "{'face_id': 'ad008886-942c-4c13-934c-8232dc7eefb2', 'label': '15859afa-37d3-41e2-8bc2-cb6f970dc6a0', 'similarity': 0.5, 'external_id': 'e1'}" | ed5ea7ce-02b3-4129-b3e8-4721b678c463 | 1      | 33  | 7       | 1            | 42d908a4-52c5-4f46-87bd-4903ee315260 | 1    | b152f0a9-2fe7-458d-9107-9783cf14e491 | Moscow | CAA  | Arbat    | Arbat  | 1            | "55.752, 36.616" | 1    | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 0370f6b6-643a-4ad6-8c30-57849d7b070b | 2021-06-18T09:01:45.115014+03:00 | 2021-06-18T09:01:45.115401+03:00 | ca23bb19-6c15-4466-a89c-b1181adaf874 | 757318b2-3570-496a-b3c2-5d8a024e0ae1 | 4fd91006-d51a-4491-8923-1c6341a579c4 | "{'face_id': 'c77bda6b-74ea-412f-989f-f27fd5be1e20', 'label': '3ac8c676-c717-4da4-8ed3-6ca9e6139c6d', 'similarity': 0.4, 'external_id': 'e2'}" | ae6381e6-0341-47bb-9989-3a3706ae99f9 | 1      | 33  | 7       | 1            | 079c8ecc-d29b-4ab5-aa65-d1954b5101d6 | 1    | e6495a29-7c25-45bd-b9f6-17d954f5a485 | Moscow | CAA  | Arbat    | Arbat  | 1            | "55.752, 36.616" | 1    | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 0370f6b6-643a-4ad6-8c30-57849d7b070a | 2021-06-18T09:01:45.114805+03:00 | 2021-06-18T09:01:45.115401+03:00 | 7e1c37d0-74f1-4ca7-8fbe-f5c26b6a5fb7 | 7c57c339-4fc3-4a1a-90e3-e932eb4b022d | 8391e7c7-a8b1-4466-8b1e-76433f3e92a7 | "{'face_id': '477a4ef7-16dc-4189-ab3b-91b1d342e101', 'label': '64058eac-eff1-4efc-b6c3-982133523a31', 'similarity': 0.3, 'external_id': 'e3'}" | 830bc063-d5ca-4eba-a8c3-2094d9e4bd32 | 1      | 33  | 7       | 1            | 5068d60e-5f50-4e45-bdbf-d68a3020097c | 1    | b3b780ea-76f2-4147-ae4e-674bbf8c8aa0 | Moscow | CAA  | Arbat    | Arbat  | 1            | "55.752, 36.616" | 1    | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |
        | 0370f6b6-643a-4ad6-8c30-57849d7b0709 | 2021-06-18T09:01:45.114531+03:00 | 2021-06-18T09:01:45.115401+03:00 | 3a95f340-9b02-4b4d-b56c-bc6aeaae46db | aa7d4de1-d4fb-4052-acb4-1ccb5be99ece | c1275d2f-95d1-4034-870f-da0a8f9d02b8 | "{'face_id': '7f5bf6fb-2ad0-42bf-98f2-fe949516db7d', 'label': 'be309d4d-deaa-479e-ba70-026a712f39e2', 'similarity': 0.2, 'external_id': 'e4'}" | 64c4f42e-e7e3-4a72-93d8-399e5c8451c9 | 1      | 33  | 7       | 1            | 7bcc784c-d699-492e-99e5-5c3cdea79764 | 1    | d0e339e3-472a-4da0-b90a-43693ca5fb47 | Moscow | CAA  | Arbat    | Arbat  | 1            | "55.752, 36.616" | 1    | 1               | 33           | 0              | "long"        | ["black", "white"]    | 2              |

    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 ]

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

    task_clustering_reply:
      allOf:
        - $ref: "#/components/schemas/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/task_template_reply"
      description: GC task content
      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_event_descriptors_task_content'
            - $ref: '#/components/schemas/gc_events_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'

    task_additional_extract_reply:
      allOf:
        - $ref: "#/components/schemas/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'
            - $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'

    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/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/task_template_reply"
      properties:
        task_type:
          allOf:
            - $ref: "#/components/schemas/task_type"
          enum: [9]
        content:
          $ref: "#/components/schemas/estimator_task_content_required"

    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'

    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: tasks_db
            error:
              error_code: 10017
              desc: Database error
              detail: Database connection timeout error
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-10017
            status: 0
          - component: tasks_worker
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0
            status: 1

    body_attributes:
      type: object
      description: Body extra attributes.
      properties:
        upper_body:
          $ref: "#/components/schemas/upper_body_attributes"
        basic_attributes:
          $ref: "#/components/schemas/body_basic_attributes"
        accessories:
          $ref: "#/components/schemas/body_accessories"

    body_basic_attributes:
      type: object
      description: Body basic attributes.
      nullable: true
      properties:
        apparent_age:
          type: integer
          maximum: 100
          minimum: 0
          description: Apparent age.
        apparent_gender:
          type: integer
          enum: [ 0, 1, 2 ]
          description: Apparent gender (0 - female, 1 - male, 2 - undefined).
      required: [ apparent_age, apparent_gender ]

    upper_body_attributes:
      type: object
      description: Upper body attributes.
      nullable: true
      properties:
        headwear:
          type: object
          properties:
            state:
              type: integer
              enum: [ 0, 1, 2 ]
              description: Headwear state (0 - absent, 1 - present, 2 - undefined).
          required: [ state ]
          description: Headwear attributes.
        sleeve:
          type: object
          properties:
            length:
              type: string
              enum: [ short, long, undefined ]
              description: Sleeve length.
          required: [ length ]
          description: Sleeve attributes.
        upper_clothing:
          type: object
          properties:
            colors:
              type: array
              items:
                type: string
                enum: [ black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored, undefined ]
              description: Upper clothing color set.
          required: [ colors ]
          description: Upper clothing attibutes.
      required: [ headwear, sleeve, upper_clothing ]

    body_accessories:
      type: object
      description: Body accessories.
      nullable: true
      properties:
        backpack:
          type: object
          properties:
            state:
              type: integer
              enum: [ 0, 1, 2 ]
              description: Backpack state (0 - absent, 1 - present, 2 - undefined).
          description: Backpack attributes.
          required: [ state ]
      required: [ backpack ]
  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'

    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:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 9
            detail: Request timeout
            desc: Request timeout on http://127.0.0.1:5050/{...}, method {...}
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-9
paths:
  /tasks/{subtask_id}:
    put:
      tags:
      - tasks

      summary: start task execution
      description: start task execution by id
      operationId: putTaskToWorker

      parameters:
      - in: path
        name: subtask_id
        schema:
          type: integer
          minimum: 1
        required: true
        description: task id
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/luna_request_id'

      responses:
        202:
          description: Accepted
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        500:
          $ref: '#/components/responses/internal_server_error'
  /2/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'
  /2/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'
  /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'