openapi: 3.0.0
info:
  version: 'v.1.11.1'
  title: 'Luna-Python-Matcher'
  description: |

          VisionLabs Luna Python Matcher.

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

          The specification can be used:

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

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

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

servers:
- description: SwaggerHub API Auto Mocking
  url: https://virtserver.swaggerhub.com/visionlabs/Luna3API/v.1.11.1

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

    application_msgpack:
      schema:
        type: string
        enum:
          - application/msgpack
      required: true
      description: content type is application/msgpack

    json_or_msgpack_content:
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      required: true
      description: Content type of a response body

    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}-4[a-f0-9]{3}-[89ab][a-f0-9]{3}-[a-f0-9]{12}$
      description: request id. Helps to uniquely identify messages that correspond to particular requests, in system logs.
      required: true

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

    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.

    json_or_msgpack_content:
      in: header
      name: Content-Type
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      description: Format of a request body data

    accept_json_or_msgpack_content:
      in: header
      name: Accept
      schema:
        type: string
        enum:
          - application/json
          - application/msgpack
      description: Response body format, default `application/json`

    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

    account_id:
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      description: account id
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'

    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

    crossmatch_sorting:
      in: query
      name: sorting
      schema:
        type: integer
        enum: [ 0, 1 ]
        default: 1
      description: whether to sort match results lexicografically
  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"

    FaceError:
      allOf:
        - $ref: '#/components/schemas/Error'
      example:
        error_code: 22002
        detail: face with id 'ea555d8a-9db1-4129-8221-6b125b3b7d5a' not found
        desc: Object not found
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22002

    int_version:
      type: integer
      minimum: 0

    accept_docs_handler:
      type: string
      enum:
        - application/x-yaml
        - text/html
      description: One of application/x-yaml, text/html

    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:
            api: 1
            major: 0
            minor: 0
            patch: 0

    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"

    common_id:
      description: user-defined id.
      type: string
      maxLength: 36
      example: "3.1415926"

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

    filter_external_id:
      description: objects whose `external_id` values are not equal to the filter will be filtered
      type: string
      maxLength: 36
      example: "2xQ2gprbMUePw1s9gw9fvA=="

    attribute_id:
      description: id of temporary attribute
      type: string
      maxLength: 36
      example: "2xQ2gpraMUePw1s9gw9fvA=="

    field_user_data:
      description: object user data.
      type: string
      maxLength: 128
      example: "100-00-12"
      default: ""

    filter_user_data:
      description: user data filter. Objects whose `user_data` values are not contain the filter will be filtered
      type: string
      maxLength: 128
      example: "100-00-12"

    avatar:
      type: string
      maxLength: 256
      format: uri-reference
      example: "https://upload.wikimedia.org/wikipedia/commons/thumb/2/2d/Yfke-sturm-1326186044.jpg/800px-Yfke-sturm-1326186044.jpg"
      default: ""
      description: avatar for face, references to a sample or a user-defined reference.

    time:
      type: string
      format: date-time
      example: "2018-08-11T09:11:41.674Z"
      description: time in format RFC 3339

    external_ids:
      type: array
      items:
        $ref: '#/components/schemas/filter_external_id'
      description: list of external ids. Each event from result will contain one of the given external ids.
      minItems: 1
      maxItems: 1000

    attribute_ids:
      type: array
      items:
        $ref: '#/components/schemas/attribute_id'
      description: list of attribute ids.
      minItems: 1

    track_ids_filter:
      type: array
      items:
        $ref: '#/components/schemas/track_id'
      description: list of track ids. Each event from result will contain one of the given track ids.
      minItems: 1
      maxItems: 1000

    create_time__gte:
      allOf:
        - $ref: '#/components/schemas/time'
      description: create time lower included boundary

    create_time__lt:
      allOf:
        - $ref: '#/components/schemas/time'
      description: create time upper excluded boundary

    end_time__gte:
      allOf:
        - $ref: '#/components/schemas/time'
      description: end time lower included boundary

    end_time__lt:
      allOf:
        - $ref: '#/components/schemas/time'
      description: end time upper excluded boundary

    face_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: face id
      example: "557d54ec-29ad-4f3c-93b4-c9092ef12515"

    face_ids:
      type: array
      items:
        $ref: '#/components/schemas/face_id'
      description: list of face ids
      minItems: 1
      maxItems: 1000

    face_id__gte:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: face id lower included boundary
      example: b668c4a5-2191-476e-a261-3b4f9ce2e25e

    face_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: face id upper excluded boundary
      example: b668c4a5-2191-476e-a261-3b4f9ce2e25e

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

    event_ids:
      type: array
      items:
        $ref: '#/components/schemas/event_id'
      description: list of event ids associated with face
      minItems: 1
      maxItems: 1000

    event_id__gte:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: event id lower included boundary
      example: b668c4a5-2191-476e-a261-3b4f9ce2e25e

    event_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: event id upper excluded boundary
      example: b668c4a5-2191-476e-a261-3b4f9ce2e25e

    list_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: id of the luna list that contains candidates.
      example: b668c4a5-2191-476e-a261-3b4f9ce2e25e

    account_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: id of the luna account.
      example: b668c4a5-2191-476e-a261-3b4f9ce2e25e

    sample_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: sample id.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    object_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: match object id (face id or event id).

    top_matching_candidates_label:
      description: top matching candidates label.
      type: string
      maxLength: 36
      example: good guys

    top_similar_object_ids:
      type: array
      items:
        $ref: '#/components/schemas/object_id'
      description: list of top similar object ids. Each event from result will contain one of the given similar object ids.
      minItems: 1
      maxItems: 1000

    top_similar_external_ids:
      type: array
      items:
        $ref: '#/components/schemas/field_external_id'
      description: list of top similar external ids. Each event from result will contain one of the given similar external ids.
      minItems: 1
      maxItems: 1000

    similarity:
      type: number
      minimum: 0
      maximum: 1
      example: 0.5

    top_similar_object_similarity__gte:
      allOf:
        - $ref: '#/components/schemas/similarity'
      description: top similar object similarity lower included bound.

    top_similar_object_similarity__lt:
      allOf:
        - $ref: '#/components/schemas/similarity'
      description: top similar object similarity upper excluded bound.

    detect_time:
      allOf:
        - $ref: "#/components/schemas/time"
        - description: detection time
      example: "2018-08-11T09:11:41.674Z"

    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

    image_origin:
      type: string
      maxLength: 256
      description: the image url - source of the detection
      nullable: true
      example: "/6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    age:
      type: integer
      minimum: 0
      maximum: 100
      description: age upper excluded bound.
      example: 50

    age__lt:
      allOf:
        - $ref: '#/components/schemas/age'
      description: age upper excluded bound.

    age__gte:
      allOf:
        - $ref: '#/components/schemas/age'
      description: age lower included bound.

    source:
      type: string
      description: some additional information that user provides with event.
      example: "3rd Avenue"
      nullable: true

    sources_filter:
      type: array
      items:
        $ref: '#/components/schemas/source'
      description: list of sources. Each event from result will contain one of the given sources in location.
      example: ['cam1', 'cam2']
      minItems: 1
      maxItems: 1000

    stream_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: handler id
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    stream_id_filter:
      type: array
      items:
        $ref: '#/components/schemas/stream_id'
      description: list of stream ids. Each event from result will contain one of the given stream ids.
      minItems: 1
      maxItems: 1000

    tags:
      description: list of tags.
      type: array
      items:
        type: string
        maxLength: 36
      example: ['tag1', 'tag2']
      minItems: 1
      maxItems: 1000

    track_id:
      description: event track id
      type: string
      pattern: '^[a-zA-Z0-9_\-]{1,36}$'
      example: "useful_track_id_number_1"
      nullable: true

    tags_filter:
      allOf:
        - $ref: '#/components/schemas/tags'
      description: list of tags. Each event from result will contain one of the given tags.

    emotion:
      type: integer
      enum: [1,2,3,4,5,6,7, null]

    emotions:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/emotion'
      description: |
        list of 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 |
      example: [1, 2, 4]

    mask_enum:
      description: |
        predominant mask.

        | masks      | value |
        |----------------|---|
        | missing        | 1 |
        | medical_mask   | 2 |
        | occluded       | 3 |

      type: integer
      enum: [1, 2, 3, null]

    masks:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/mask_enum'
      description: |
        list of masks. Each event from result will contain one of the given mask states.

        | masks      | value |
        |----------------|---|
        | missing        | 1 |
        | medical_mask   | 2 |
        | occluded       | 3 |

      example: "2,3"

    liveness_enum:
      description: |
        predominant liveness.

        | liveness | value |
        |--------------|---|
        | spoof        | 0 |
        | real         | 1 |
        | unknown      | 2 |

      type: integer
      enum: [0, 1, 2, null]


    liveness_filter:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/liveness_enum'
      description: |
        list of liveness. Each event from result will contain one of the given liveness.

        | liveness | value |
        |--------------|---|
        | spoof        | 0 |
        | real         | 1 |
        | unknown      | 2 |
        

    deepfake_enum:
      description: |
        predominant deepfake.

        | deepfake | value |
        |--------------|---|
        | fake         | 0 |
        | real         | 1 |

      type: integer
      enum: [0, 1, null]


    deepfake_filter:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/deepfake_enum'
      description: |
        list of deepfake. Each event from result will contain one of the given deepfake.

        | deepfake | value |
        |--------------|---|
        | fake         | 0 |
        | real         | 1 |

    apparent_gender_filter:
      type: array
      minItems: 1
      items:
        type: integer
        enum: [ 0, 1, 2, null]
      description: |
        Apparent gender filter: 0 - female, 1 - male, 2 - undefined. Each event from result will contain one of the given states.
      example: [ 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_filter:
      type: array
      minItems: 1
      items:
        type: integer
        enum: [ 0, 1, 2, null]
      description: |
       Headwear state filter: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.
      example: [ 1 ]

    headwear_color:
      type: string
      enum: [ undefined, black, white, other ]
      description: Headwear apparent color.

    headwear_colors_filter:
      type: array
      minItems: 1
      items:
        type: string
        enum: [ undefined, black, white, other, null]
        description: Headwear apparent color.
      description: |
        Headwear apparent color filter. Each event from result will contain one of the given states.
      example: [ black ]

    sleeve_lengths_filter:
      type: array
      minItems: 1
      items:
        type: string
        enum: [ short, long, undefined, null]
      description: |
        Sleeve length state filter. Each event from result will contain one of the given states.
      example: [ short ]

    clothing_color:
      type: string
      enum: [ undefined, black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored ]
      description: Clothing color.

    upper_clothing_colors_filter:
      type: array
      minItems: 1
      items:
          type: string
          enum: [ undefined, black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored, null]
          description: Clothing color.
      description: |
        Upper clothing color filter. Each event from result will contain at least one of the given clothing colors.
      example: [ black, white ]

    lower_garment_types_filter:
      type: array
      minItems: 1
      items:
        type: integer
        enum: [ undefined, trousers, shorts, skirt, null]
      description: |
        Lower garment type filter. Each event from result will contain one of the given states.
      example: [ trousers ]

    lower_garment_colors_filter:
      type: array
      minItems: 1
      items:
          type: string
          enum: [ undefined, black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored, null]
          description: Clothing color.
      description: |
        Lower garment color filter. Each event from result will contain at least one of the given clothing colors.
      example: [ black, white ]

    shoes_color:
      type: string
      enum: [ undefined, black, white, other ]
      description: Shoes apparent color.

    shoes_colors_filter:
      type: array
      minItems: 1
      items:
        type: string
        enum: [ undefined, black, white, other, null]
        description: Shoes apparent color.
        nullable: true
      description: |
        Shoes apparent color filter. Each event from result will contain one of the given states.
      example: [ black ]

    backpack_states_filter:
      type: array
      minItems: 1
      items:
        type: integer
        enum: [ 0, 1, 2, null]
      description: |
        Backpack state filter: 0 - absent, 1 - present, 2 - undefined. Each event from result will contain one of the given states.
      example: [ 1 ]

    handler_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
      description: handler id
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    handler_ids:
      type: array
      items:
        $ref: '#/components/schemas/handler_id'
      description: list of handler ids. Each event from result will contain one of the given handler ids.
      minItems: 1
      maxItems: 1000

    ethnic_group:
      type: integer
      enum: [1,2,3,4,null]

    ethnic_groups:
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/ethnic_group'
      description: |
        list of ethnic group. Each event from result will contain one of the given ethnic groups.

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

    ethnicity:
      type: integer
      enum: [1, 2, 3, 4]
      description: |
        estimated ethnicity (predominant)

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

    gender:
      type: integer
      enum: [0, 1]
      description: gender, 0 - female, 1 - male

    location_str:
      type: string
      maxLength: 36
      nullable: true

    location:
      type: object
      description: information about a place where event is incidented
      properties:
        city:
          allOf:
            - $ref: '#/components/schemas/location_str'
            - description: city where event is incidented
        area:
          allOf:
            - $ref: '#/components/schemas/location_str'
            - description: area where event is incidented
        district:
          allOf:
            - $ref: '#/components/schemas/location_str'
            - description: district where event is incidented
        street:
          allOf:
            - $ref: '#/components/schemas/location_str'
            - description: street where event is incidented
        house_number:
          allOf:
            - $ref: '#/components/schemas/location_str'
            - description: house number where event is incidented
        geo_position:
          allOf:
            - $ref: '#/components/schemas/geo_position'
            - nullable: true
      example:
        city: Moscow
        area: CAO
        district: Arbat
        street: Arbat
        house_number: "3"
        geo_position:
          longitude: 36.616
          latitude: 55.752

    face:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        external_id:
          $ref: '#/components/schemas/field_external_id'
        user_data:
          $ref: '#/components/schemas/field_user_data'
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: time of the face creation.
        avatar:
          $ref: '#/components/schemas/avatar'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/uuid'
          minItems: 0
          description: list of luna lists, which contain the face.
        event_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
            - description: event id associated with the face creation.
            - nullable: true
      minProperties: 1
      example:
        face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        user_data: fox1991
        create_time: "2018-08-11T09:11:41.674Z"
        lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
        avatar: "https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg"
        event_id: "f9687459-986b-406d-9c1f-0d6289be5256"

    face_candidates_in_target_match_result:
      type: array
      items:
        type: object
        properties:
          similarity:
            $ref: '#/components/schemas/similarity'
          face:
            type: object
            properties:
              face_id:
                allOf:
                  - $ref: '#/components/schemas/face_id'
                nullable: true
              external_id:
                allOf:
                  - $ref: '#/components/schemas/field_external_id'
                nullable: true
              user_data:
                allOf:
                  - $ref: '#/components/schemas/field_user_data'
                nullable: true
              create_time:
                allOf:
                  - $ref: "#/components/schemas/time"
                  - description: time of the face creation.
                nullable: true
            required: [face_id, external_id, user_data, create_time]
        required: [similarity, face]
      minItems: 0

    event_candidates_in_target_match_result:
      type: array
      items:
        type: object
        properties:
          similarity:
            $ref: '#/components/schemas/similarity'
          event:
            type: object
            properties:
              event_id:
                allOf:
                  - $ref: '#/components/schemas/event_id'
                nullable: true
              external_id:
                allOf:
                  - $ref: '#/components/schemas/field_external_id'
                nullable: true
              handler_id:
                allOf:
                  - $ref: '#/components/schemas/handler_id'
                nullable: true
              source:
                $ref: '#/components/schemas/source'
              stream_id:
                $ref: '#/components/schemas/stream_id'
              user_data:
                allOf:
                  - $ref: '#/components/schemas/field_user_data'
                nullable: true
              create_time:
                allOf:
                  - $ref: "#/components/schemas/time"
                  - description: time of the event creation.
                nullable: true
                example: "2018-08-11T09:11:41.674Z"
            required: [event_id, external_id, handler_id, source, stream_id, user_data, create_time]
        required: [similarity, event]
      minItems: 0

    top_match_face:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: similarity to the most similar face.
        face_id:
          allOf:
          - $ref: '#/components/schemas/face_id'
          nullable: true
        external_id:
          allOf:
          - $ref: '#/components/schemas/field_external_id'
          nullable: true
      required: [face_id, similarity, label, external_id]

    top_match_event:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: similarity to the most similar event.
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          nullable: true
        external_id:
          allOf:
          - $ref: '#/components/schemas/field_external_id'
          nullable: true
      required: [event_id, similarity, label, external_id]

    detection:
      type: object
      properties:
        sample_id:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/sample_id'
        detection:
          type: object
          description: detection
          properties:
            rect:
              type: object
              description: detection rectangle
              properties:
                x:
                  type: integer
                  description: detection rectangle x coordinate
                y:
                  type: integer
                  description: detection rectangle y coordinate
                width:
                  type: integer
                  description: detection rectangle width
                height:
                  type: integer
                  description: detection rectangle height
              required: [x, y, width, height]
          required: [rect]
        detect_time:
          $ref: '#/components/schemas/detect_time'
        detect_ts:
          $ref: '#/components/schemas/detect_ts'
        image_origin:
          $ref: '#/components/schemas/image_origin'
      required: [sample_id, detect_time, image_origin, detect_ts]
      example:
        sample_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
        detection:
          rect: {x: 0, y: 0, width: 0, height: 0}
        detect_time: "2018-08-11T09:11:41.674Z"
        image_origin: /6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e

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

    upper_body_attributes:
      type: object
      nullable: true
      description: Upper body attributes.
      properties:
        headwear:
          type: object
          properties:
            state:
              type: integer
              enum: [ 0, 1, 2 ]
              description: Headwear state (0 - absent, 1 - present, 2 - undefined).
            apparent_color:
              allOf:
                - $ref: '#/components/schemas/headwear_color'
              nullable: true
          required: [ state, apparent_color ]
          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:
                $ref: '#/components/schemas/clothing_color'
              description: Upper clothing color set.
          required: [ colors ]
          description: Upper clothing attibutes.
      required: [ headwear, sleeve, upper_clothing ]

    lower_body_attributes:
      type: object
      description: Lower body attributes.
      nullable: true
      properties:
        lower_garment:
          type: object
          properties:
            type:
              type: string
              enum: [ undefined, trousers, shorts, skirt ]
            colors:
              type: array
              items:
                $ref: '#/components/schemas/clothing_color'
              description: |
                Lower clothing color set.
                If lower garment `type` evaluates to "undefined", the value of the color is also set to "undefined".
          required: [ type, colors ]
          description: Lower clothing attibutes.
        shoes:
          type: object
          properties:
            apparent_color:
              $ref: '#/components/schemas/shoes_color'
          required: [ apparent_color ]
          description: Shoes attributes.
      required: [ lower_garment, shoes ]

    body_accessories:
      type: object
      nullable: true
      description: Body accessories.
      properties:
        backpack:
          type: object
          properties:
            state:
              type: integer
              enum: [ 0, 1, 2 ]
              description: Backpack state (0 - absent, 1 - present, 2 - undefined).
          required: [ state ]
          description: Backpack attributes.
      required: [ backpack ]

    event:
      type: object
      description: event.
      properties:
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: event creation time
        end_time:
          allOf:
            - $ref: '#/components/schemas/time'
          description: end time of event
        event_id:
          allOf:
            - $ref: '#/components/schemas/event_id'
          description: event id.
        handler_id:
          allOf:
            - $ref: '#/components/schemas/handler_id'
          description: id of the handler, which gave birth to the event.
        account_id:
          $ref: '#/components/schemas/account_id'
        external_id:
          $ref: '#/components/schemas/field_external_id'
        source:
          $ref: '#/components/schemas/source'
        stream_id:
          $ref: '#/components/schemas/stream_id'
        top_match:
          nullable: true
          description: top match result from handler match policy
          oneOf:
            - $ref: '#/components/schemas/top_match_face'
            - $ref: '#/components/schemas/top_match_event'
        match_result:
          description: object that contains match result.
          type: array
          nullable: true
          items:
            type: object
            properties:
              label:
                $ref: '#/components/schemas/top_matching_candidates_label'
              candidates:
                oneOf:
                  - $ref: '#/components/schemas/face_candidates_in_target_match_result'
                  - $ref: '#/components/schemas/event_candidates_in_target_match_result'
            required: [label, candidates]
            example:
              label: good guys
              candidates: [{
                face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6,
                external_id: 2xQ2gprbMUePw1s9gw9fvA==,
                user_data: fox1991,
                create_time: "2018-08-11T09:11:41.674Z"
              }]
        face_detections:
          description: List of all face detections and corresponding sample ids
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/detection'
        body_detections:
          description: List of all body detections and corresponding sample ids
          type: array
          nullable: true
          items:
            $ref: '#/components/schemas/detection'
        face_id:
          allOf:
            - $ref: '#/components/schemas/face_id'
          nullable: true
        attach_result:
          description: contains attached lists ids.
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          minItems: 0
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
          nullable: true
        age:
          allOf:
            - $ref: '#/components/schemas/age'
          nullable: true
        emotion:
          allOf:
            - $ref: '#/components/schemas/emotion'
          nullable: true
        mask:
          allOf:
            - $ref: '#/components/schemas/mask_enum'
          nullable: true
        track_id:
          $ref: '#/components/schemas/track_id'
        ethnic_group:
          allOf:
            - $ref: '#/components/schemas/ethnic_group'
          nullable: true
        tags:
          allOf:
            - $ref: '#/components/schemas/tags'
          nullable: true
        user_data:
          $ref: '#/components/schemas/field_user_data'
        location:
          $ref: '#/components/schemas/location'
        liveness:
          $ref: '#/components/schemas/liveness_enum'
        deepfake:
          $ref: '#/components/schemas/deepfake_enum'
        body_basic_attributes:
          $ref: '#/components/schemas/body_basic_attributes'
        upper_body_attributes:
          $ref: '#/components/schemas/upper_body_attributes'
        lower_body_attributes:
          $ref: '#/components/schemas/lower_body_attributes'
        body_accessories:
          $ref: '#/components/schemas/body_accessories'
        meta:
          type: object
          nullable: true
          additionalProperties: true
          description: User defined metadata (json object).
          example:
            {
               "key": "value"
            }
      minProperties: 1

    basic_attributes:
      type: object
      description: |
        basic attributes. Each basic attribute was aggregated from the samples. Samples is needed for re-extract
        attributes of new algorithm version and visualisation.

      properties:
        age:
          $ref: '#/components/schemas/age'
        gender:
          $ref: '#/components/schemas/gender'
        ethnicity:
          $ref: '#/components/schemas/ethnicity'
      required: [age, gender, ethnicity]

    attributes_samples:
      type: array
      items:
        $ref: '#/components/schemas/sample_id'
      minItems: 0
      maxItems: 1000
      uniqueItems: True
      description: |
        list of *uniqie* sample ids which are resources for estimation attributes.

        > **WARNING**: if user does not set any attributes samples faces with such attributes will be skipped in
        a process of updating attributes with using new estimation algorithm.
      default: []
      example: [ee4c42b6-23ae-410e-a2aa-a4220e64ba4b, e909cfbe-29d3-44ed-a949-6cb700b89eba]

    attribute:
      type: object
      description: temporary attribute.
      properties:
        create_time:
          allOf:
            - $ref: '#/components/schemas/time'
            - description: attribute creation time
        attribute_id:
          allOf:
            - $ref: '#/components/schemas/attribute_id'
            - description: attribute id.
        account_id:
          $ref: '#/components/schemas/account_id'
        basic_attributes:
          allOf:
            - $ref: '#/components/schemas/basic_attributes'
            - nullable: true
        basic_attributes_samples:
          $ref: '#/components/schemas/attributes_samples'
        face_descriptor_samples:
          $ref: '#/components/schemas/attributes_samples'
      minProperties: 1

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

    body_descriptor_version:
      type: integer
      description: the human body descriptor version
      enum: [102, 103, 104, 105, 106, 107]

    descriptor_data:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: byte
          description: raw descriptor encoded in base64
        version:
          oneOf:
          - $ref: '#/components/schemas/face_descriptor_version'
          - $ref: '#/components/schemas/body_descriptor_version'
      required: [descriptor, version]

    face_descriptor_data:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: byte
          description: raw descriptor encoded in base64
        version:
          $ref: '#/components/schemas/face_descriptor_version'
      required: [ descriptor, version ]

    body_descriptor_data:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: byte
          description: raw descriptor encoded in base64
        version:
          $ref: '#/components/schemas/body_descriptor_version'
      required: [ descriptor, version ]

    xpk_file:
      type: string
      format: byte
      description:  xpk file encoded in base64

    sdk_descriptor:
      type: string
      format: byte
      description:  luna sdk descriptor encoded in base64. The descriptor version, a signuture and descriptor.

    reference:
      type: object
      description: reference for matching
      properties:
        type:
          description: type of reference
        id:
          description: reference id
      required: [id, type]

    face_reference:
      allOf:
        - $ref: '#/components/schemas/reference'
        - properties:
            type:
              type: string
              enum: ["face"]
            id:
              $ref: '#/components/schemas/uuid'

    external_face_reference:
      allOf:
        - $ref: '#/components/schemas/reference'
        - properties:
            type:
              type: string
              enum: ["face_external_id"]
            id:
              $ref: '#/components/schemas/field_external_id'

    attribute_reference:
      allOf:
        - $ref: '#/components/schemas/reference'
        - properties:
            type:
              type: string
              enum: ["attribute"]
            id:
              $ref: '#/components/schemas/uuid'

    event_reference:
      allOf:
        - $ref: '#/components/schemas/reference'
        - properties:
            type:
              type: string
              enum: ["event"]
            id:
              $ref: '#/components/schemas/uuid'

    external_event_reference:
      allOf:
        - $ref: '#/components/schemas/reference'
        - properties:
            type:
              type: string
              enum: ["event_external_id"]
            id:
              allOf:
                - $ref: '#/components/schemas/field_external_id'
              description: user-defined external id for event

    track_event_reference:
      allOf:
        - $ref: '#/components/schemas/reference'
        - properties:
            type:
              type: string
              enum: [ "event_track_id" ]
            id:
              allOf:
                - $ref: '#/components/schemas/common_id'
              description: track id associated with event

    areas_filter:
      description: List of areas. Each event from result will contain one of the given areas in location.
      type: array
      items:
        type: string
        maxLength: 36
      example: ['area1', 'area2', null]
      minItems: 1
      maxItems: 1000

    cities_filter:
      type: array
      items:
        type: string
        maxLength: 36
      description: List of cities. Each event from result will contain one of the given cities in location.
      example: ["moscow", "New-York", null]
      minItems: 1
      maxItems: 1000

    districts_filter:
      type: array
      items:
        type: string
        maxLength: 36
      description: List of districts. Each event from result will contain one of the given districts in location.
      example: ["mitino", "central park", null]
      minItems: 1
      maxItems: 1000

    streets_filter:
      type: array
      items:
        type: string
        maxLength: 36
      description: List of streets. Each event from result will contain one of the given streets in location.
      example: ["arbat, schepkina", null]
      minItems: 1
      maxItems: 1000

    house_numbers_filter:
      type: array
      items:
        type: string
        maxLength: 36
      description: List of house numbers. Each event from result will contain one of the given house numbers in location.
      example: ["1", "1/2str3", null]
      minItems: 1
      maxItems: 1000

    longitude:
      type: number
      minimum: -180
      maximum: 180
      example: 36.616

    latitude:
      type: number
      minimum: -90
      maximum: 90
      example: 55.752

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

    geo_position_bbox_filter:
      description: |
          geo position filter is a 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.
      properties:
        origin_longitude:
          allOf:
            - $ref: '#/components/schemas/longitude'
            - description: origin longitude in degrees
        origin_latitude:
          allOf:
            - $ref: '#/components/schemas/latitude'
            - description: origin latitude in degrees
        longitude_delta:
          description: |
              longitude delta in degrees. Box edges more than 180 degrees long are not allowed.
              Boundaries of valid range are **exclusive**. NOTE: highly recommended for citywide use only.
          type: number
          minimum: 0
          maximum: 90
          default: 0.01
          example: 0.01
        latitude_delta:
          description: |
              latitude delta in degrees. Box edges more than 180 degrees long are not allowed.
              Boundaries of valid range are **exclusive**. NOTE: highly recommended for citywide use only.
          type: number
          minimum: 0
          maximum: 90
          default: 0.01
          example: 0.01
      nullable: true
      required: [origin_longitude, origin_latitude]

    match_origin_faces:
      type: string
      enum: ["faces"]
      description: resource candidates type.

    match_origin_events:
      type: string
      enum: ["events"]
      description: resource candidates type.

    match_origin_attributes:
      type: string
      enum: ["attributes"]
      description: resource candidates type.

    face_filters:
      type: object
      description: candidate face filters
      properties:
        origin:
          $ref: '#/components/schemas/match_origin_faces'
        face_ids:
          $ref: '#/components/schemas/face_ids'
        account_id:
          $ref: '#/components/schemas/account_id'
        external_ids:
          $ref: '#/components/schemas/external_ids'
        user_data:
          $ref: '#/components/schemas/filter_user_data'
        create_time__gte:
          $ref: '#/components/schemas/create_time__gte'
        create_time__lt:
          $ref: '#/components/schemas/create_time__lt'
        face_id__gte:
          $ref: '#/components/schemas/face_id__gte'
        face_id__lt:
          $ref: '#/components/schemas/face_id__lt'
        list_id:
          $ref: '#/components/schemas/list_id'
      required: [origin]

    event_filters:
      type: object
      description: candidate event filters
      properties:
        origin:
          $ref: '#/components/schemas/match_origin_events'
        event_ids:
          $ref: '#/components/schemas/event_ids'
        account_id:
          $ref: '#/components/schemas/account_id'
        event_id__gte:
          $ref: '#/components/schemas/event_id__gte'
        event_id__lt:
          $ref: '#/components/schemas/event_id__lt'
        create_time__gte:
          $ref: '#/components/schemas/create_time__gte'
        create_time__lt:
          $ref: '#/components/schemas/create_time__lt'
        end_time__gte:
          $ref: '#/components/schemas/end_time__gte'
        end_time__lt:
          $ref: '#/components/schemas/end_time__lt'
        handler_ids:
          $ref: '#/components/schemas/handler_ids'
        external_ids:
          $ref: '#/components/schemas/external_ids'
        top_matching_candidates_label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        top_similar_object_ids:
          $ref: '#/components/schemas/top_similar_object_ids'
        top_similar_external_ids:
          $ref: '#/components/schemas/top_similar_external_ids'
        top_similar_object_similarity__gte:
          $ref: '#/components/schemas/top_similar_object_similarity__gte'
        top_similar_object_similarity__lt:
          $ref: '#/components/schemas/top_similar_object_similarity__lt'
        age__gte:
          $ref: '#/components/schemas/age__gte'
        age__lt:
          $ref: '#/components/schemas/age__lt'
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
          nullable: true
        emotions:
          $ref: '#/components/schemas/emotions'
        masks:
          $ref: '#/components/schemas/masks'
        ethnic_groups:
          $ref: '#/components/schemas/ethnic_groups'
        face_ids:
          $ref: '#/components/schemas/face_ids'
        user_data:
          $ref: '#/components/schemas/filter_user_data'
        sources:
          $ref: '#/components/schemas/sources_filter'
        stream_ids:
          $ref: '#/components/schemas/stream_id_filter'
        tags:
          $ref: '#/components/schemas/tags_filter'
        cities:
          $ref: '#/components/schemas/cities_filter'
        areas:
          $ref: '#/components/schemas/areas_filter'
        districts:
          $ref: '#/components/schemas/districts_filter'
        streets:
          $ref: '#/components/schemas/streets_filter'
        house_numbers:
          $ref: '#/components/schemas/house_numbers_filter'
        geo_position:
          $ref: '#/components/schemas/geo_position_bbox_filter'
        track_ids:
          $ref: '#/components/schemas/track_ids_filter'
        liveness:
          $ref: '#/components/schemas/liveness_filter'
        deepfake:
          $ref: '#/components/schemas/deepfake_filter'
        apparent_gender:
          $ref: '#/components/schemas/apparent_gender_filter'
        apparent_age__gte:
          $ref: '#/components/schemas/apparent_age__gte'
        apparent_age__lt:
          $ref: '#/components/schemas/apparent_age__lt'
        headwear_states:
          $ref: '#/components/schemas/headwear_states_filter'
        headwear_apparent_colors:
          $ref: '#/components/schemas/headwear_colors_filter'
        sleeve_lengths:
          $ref: '#/components/schemas/sleeve_lengths_filter'
        upper_clothing_colors:
          $ref: '#/components/schemas/upper_clothing_colors_filter'
        lower_garment_types:
          $ref: '#/components/schemas/lower_garment_types_filter'
        lower_garment_colors:
          $ref: '#/components/schemas/lower_garment_colors_filter'
        shoes_apparent_colors:
          $ref: '#/components/schemas/shoes_colors_filter'
        backpack_states:
          $ref: '#/components/schemas/backpack_states_filter'
        meta:
          type: object
          nullable: true
          additionalProperties: true
          description: |
            User-defined event meta's filters.

            Parameter name pattern: `path.to.field[__operator]`

            Path to field is an event meta's json field path. To navigate through nested objects the dot (.) is used.

            Field comparison **operator** is optional one of `eq` (default), `neq`, `like`, `nlike`, `in`, `nin`, `gt`, `gte`, `lt`, `lte`.

            Please note importance of using correct types when filtering. For example, the following filter is not valid:
            {"age__gt": 20.0} in case some of the metas contain `age` with datatype different from `number`.

            Allowed usage of filters is:

            |  operator  | type |        |         |         |
            |------------|------|--------|---------|---------|
            |            | none | string | integer | numeric |
            | eq         | +    | +      | +       | +       |
            | neq        | +    | +      | +       | +       |
            | like       | -    | +      | -       | -       |
            | nlike      | -    | +      | -       | -       |
            | in         | +    | +      | +       | +       |
            | nin        | +    | +      | +       | +       |
            | gt         | -    | +      | +       | +       |
            | gte        | -    | +      | +       | +       |
            | lt         | -    | +      | +       | +       |
            | lte        | -    | +      | +       | +       |

          example: {"user.email": "root@localhost", "user.age__gt": 18}
      required: [origin]

    cross_match_face_filters:
      allOf:
        - type: object
          properties:
            origin:  # to keep the order
              $ref: '#/components/schemas/match_origin_faces'
            face_ids:
              allOf:
                - $ref: '#/components/schemas/face_ids'
              maxItems: 20000  # to be overwritten it should be out of *allOf*
        - $ref: '#/components/schemas/face_filters'

    cross_match_event_filters:
      allOf:
        - type: object
          properties:
            origin:  # to keep the order
              $ref: '#/components/schemas/match_origin_events'
            event_ids:
              allOf:
                - $ref: '#/components/schemas/event_ids'
              maxItems: 20000  # to be overwritten it should be out of *allOf*
        - $ref: '#/components/schemas/event_filters'

    cross_match_attribute_filters:
      allOf:
        - type: object
          properties:
            origin:  # to keep the order
              $ref: '#/components/schemas/match_origin_attributes'
            attribute_ids:
              allOf:
                - $ref: '#/components/schemas/attribute_ids'
              maxItems: 20000  # to be overwritten it should be out of *allOf*
        - $ref: '#/components/schemas/attribute_filters'

    matching_sort_order:
      type: string
      enum: [ similarity, create_time_asc, create_time_desc ]
      description: matching sort order.
      default: similarity

    limit:
      type: integer
      minimum: 1
      default: 3
      maximum: 100
      description: count of match result for candidate list.

    cross_match_limit:
      type: integer
      minimum: 1
      default: 20000
      maximum: 20000
      description: count of cross match results for each reference.

    targets_attributes:
      type: array
      items:
        type: string
        enum: ["attribute_id", "account_id", "basic_attributes", "basic_attributes_samples", "face_descriptor_samples", "create_time", "similarity"]
      description: |
        List of temporary attributes fields.
        If set, each attribute from result will contain only specified fields, otherwise, attribute with all fields will be returned.
      default: ["attribute_id", "account_id", "basic_attributes", "basic_attributes_samples", "face_descriptor_samples", "create_time", "similarity"]

    targets_faces:
      type: array
      items:
        type: string
        enum: ["face_id", "account_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists",
               "similarity"]
      description: |
        List of face fields.
        If set, each face from result will contain only specified fields, otherwise, faces with all fields will be returned.
      default: ["face_id", "account_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists",
                "similarity"]

    targets_events:
      type: array
      items:
        type: string
        enum: ["event_id", "account_id", "create_time", "end_time", "external_id", "handler_id", "stream_id", "source",
               "top_match",  "match_result", "face_detections", "body_detections", "face_id", "attach_result", "gender", "age", "emotion",
               "ethnic_group", "tags", "user_data", "location", "similarity", "mask", "track_id", "liveness", "deepfake",
               "body_basic_attributes", "upper_body", "lower_body", "accessories", "meta"
        ]
      description: |
        List of event fields.
        If set, each event from result will contain only specified fields, otherwise, events with all fields will be returned.
      default: ["event_id", "account_id", "create_time", "end_time", "external_id", "handler_id", "stream_id", "source",
                "top_match", "match_result", "face_detections", "body_detections", "face_id", "attach_result", "gender", "age", "emotion",
                "ethnic_group", "tags", "user_data", "location", "similarity", "mask", "track_id", "liveness", "deepfake",
                "body_basic_attributes", "upper_body", "lower_body", "accessories", "meta"
      ]

    threshold:
      type: number
      minimum: 0
      maximum: 1
      default: 0
      description: matching similarity threshold

    attribute_filters:
      type: object
      description: candidate filters for temporary attribute
      properties:
        origin:
          type: string
          enum: ["attributes"]
          description: filters type discriminator
        account_id:
          $ref: '#/components/schemas/account_id'
        attribute_ids:
          $ref: '#/components/schemas/attribute_ids'
      required: [origin, attribute_ids]

    candidate_attribute:
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/attribute_filters'
        order:
          $ref: '#/components/schemas/matching_sort_order'
        limit:
          $ref: '#/components/schemas/limit'
        targets:
          $ref: '#/components/schemas/targets_attributes'
        threshold:
          $ref: '#/components/schemas/threshold'
      required: [filters]

    candidate_face:
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/face_filters'
        order:
          $ref: '#/components/schemas/matching_sort_order'
        limit:
          $ref: '#/components/schemas/limit'
        targets:
          $ref: '#/components/schemas/targets_faces'
        threshold:
          $ref: '#/components/schemas/threshold'
      required: [filters]

    candidate_event:
      type: object
      properties:
        filters:
          $ref: '#/components/schemas/event_filters'
        order:
          $ref: '#/components/schemas/matching_sort_order'
        limit:
          $ref: '#/components/schemas/limit'
        targets:
          $ref: '#/components/schemas/targets_events'
        threshold:
          $ref: '#/components/schemas/threshold'
      required: [filters]

    match_faces_request_json:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/face_reference'
              - $ref: '#/components/schemas/external_face_reference'
              - $ref: '#/components/schemas/attribute_reference'
              - $ref: '#/components/schemas/event_reference'
              - $ref: '#/components/schemas/external_event_reference'
              - $ref: '#/components/schemas/track_event_reference'
              - $ref: '#/components/schemas/xpk_file_entity'
              - $ref: '#/components/schemas/sdk_descriptor_entity'
              - $ref: '#/components/schemas/raw_face_descriptor_entity'
            discriminator:
              propertyName: type
              mapping:
                face: '#/components/schemas/face_reference'
                face_external_id: '#/components/schemas/external_face_reference'
                attribute: '#/components/schemas/attribute_reference'
                event: '#/components/schemas/event_reference'
                event_external_id: '#/components/schemas/external_event_reference'
                event_track_id: '#/components/schemas/track_event_reference'
                xpk_file: '#/components/schemas/xpk_file_entity'
                sdk_descriptor: '#/components/schemas/sdk_descriptor_entity'
                raw_descriptor: '#/components/schemas/raw_face_descriptor_entity'
          description: References for matching. Each reference is matched with all given candidates. You can specify one or several references of one or several types.
          minItems: 1
          maxItems: 30
        candidates:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/candidate_face'
              - $ref: '#/components/schemas/candidate_event'
              - $ref: '#/components/schemas/candidate_attribute'
          minItems: 1
          maxItems: 30
          description: Candidates for matching.
      required: [references, candidates]

    match_faces_request_msgpack:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/face_reference'
              - $ref: '#/components/schemas/external_face_reference'
              - $ref: '#/components/schemas/attribute_reference'
              - $ref: '#/components/schemas/event_reference'
              - $ref: '#/components/schemas/external_event_reference'
              - $ref: '#/components/schemas/track_event_reference'
              - $ref: '#/components/schemas/xpk_file_entity_binary'
              - $ref: '#/components/schemas/sdk_descriptor_entity_binary'
              - $ref: '#/components/schemas/raw_face_descriptor_entity_binary'
            discriminator:
              propertyName: type
              mapping:
                face: '#/components/schemas/face_reference'
                face_external_id: '#/components/schemas/external_face_reference'
                attribute: '#/components/schemas/attribute_reference'
                event: '#/components/schemas/event_reference'
                event_external_id: '#/components/schemas/external_event_reference'
                event_track_id: '#/components/schemas/track_event_reference'
                xpk_file: '#/components/schemas/xpk_file_entity_binary'
                sdk_descriptor: '#/components/schemas/sdk_descriptor_entity_binary'
                raw_descriptor: '#/components/schemas/raw_face_descriptor_entity_binary'
          description: References for matching. Each reference is matched with all given candidates. You can specify one or several references of one or several types.
          minItems: 1
          maxItems: 30
        candidates:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/candidate_face'
              - $ref: '#/components/schemas/candidate_event'
              - $ref: '#/components/schemas/candidate_attribute'
          minItems: 1
          maxItems: 30
          description: Candidates for matching.
      required: [ references, candidates ]

    match_bodies_request_json:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/event_reference'
              - $ref: '#/components/schemas/external_event_reference'
              - $ref: '#/components/schemas/track_event_reference'
              - $ref: '#/components/schemas/sdk_descriptor_entity'
              - $ref: '#/components/schemas/raw_body_descriptor_entity'
            discriminator:
              propertyName: type
              mapping:
                event: '#/components/schemas/event_reference'
                event_external_id: '#/components/schemas/external_event_reference'
                event_track_id: '#/components/schemas/track_event_reference'
                sdk_descriptor: '#/components/schemas/sdk_descriptor_entity'
                raw_descriptor: '#/components/schemas/raw_body_descriptor_entity'
          description: References for matching. Each reference is matched with all given candidates. You can specify one or several references of one or several types.
          minItems: 1
          maxItems: 30
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/candidate_event'
          minItems: 1
          maxItems: 30
          description: Candidates for matching.
      required: [references, candidates]

    match_bodies_request_msgpack:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/event_reference'
              - $ref: '#/components/schemas/external_event_reference'
              - $ref: '#/components/schemas/track_event_reference'
              - $ref: '#/components/schemas/sdk_descriptor_entity_binary'
              - $ref: '#/components/schemas/raw_body_descriptor_entity_binary'
            discriminator:
              propertyName: type
              mapping:
                event: '#/components/schemas/event_reference'
                event_external_id: '#/components/schemas/external_event_reference'
                event_track_id: '#/components/schemas/track_event_reference'
                sdk_descriptor: '#/components/schemas/sdk_descriptor_entity_binary'
                raw_descriptor: '#/components/schemas/raw_body_descriptor_entity_binary'
          description: References for matching. Each reference is matched with all given candidates. You can specify one or several references of one or several types.
          minItems: 1
          maxItems: 30
        candidates:
          type: array
          items:
            $ref: '#/components/schemas/candidate_event'
          minItems: 1
          maxItems: 30
          description: Candidates for matching.
      required: [ references, candidates ]

    base_candidate_match_result:
      type: object
      properties:
        similarity:
          $ref: '#/components/schemas/similarity'
      description: match result for the *reference_id* and a luna list or a list of faces.

    face_candidate_match_result:
      allOf:
        - $ref: '#/components/schemas/base_candidate_match_result'
        - properties:
            face:
              $ref: '#/components/schemas/face'
          required: [face]

    event_candidate_match_result:
      allOf:
        - $ref: '#/components/schemas/base_candidate_match_result'
        - properties:
            event:
              $ref: '#/components/schemas/event'
          required: [event]

    attribute_candidate_match_result:
      allOf:
        - $ref: '#/components/schemas/base_candidate_match_result'
        - properties:
            attribute:
              $ref: '#/components/schemas/attribute'
          required: [attribute]

    matches_error:
      description: sorted list with match result for the *reference_id* with error.
      type: object
      properties:
        filters:
          oneOf:
            - $ref: '#/components/schemas/face_filters'
            - $ref: '#/components/schemas/event_filters'
            - $ref: '#/components/schemas/attribute_filters'
          description: candidate filters
        error:
          allOf:
            - $ref: '#/components/schemas/Error'
            - type: object
          description: mathcing error
      required: [filters, error]
      minItems: 1

    face_match_result_item:
      type: object
      properties:
        filters:
          allOf:
             - $ref: '#/components/schemas/face_filters'
          description: candidate filters
        result:
          type: array
          description: Array of matched candidates sorted by estimated similarity.
          items:
            $ref: '#/components/schemas/face_candidate_match_result'
          minItems: 0
      required: [filters, result]

    event_match_result_item:
      type: object
      properties:
        filters:
          allOf:
            - $ref: '#/components/schemas/event_filters'
          description: candidate filters
        result:
          type: array
          description: Array of matched candidates sorted by estimated similarity.
          items:
            $ref: '#/components/schemas/event_candidate_match_result'
          minItems: 0
      required: [filters, result]

    attribute_match_result_item:
      type: object
      properties:
        filters:
          allOf:
            - $ref: '#/components/schemas/attribute_filters'
          description: candidate filters
        result:
          type: array
          description: Array of matched candidates sorted by estimated similarity.
          items:
            $ref: '#/components/schemas/attribute_candidate_match_result'
          minItems: 0
      required: [filters, result]

    uuid_reference:
      description: reference id - face id or attribute id or event_id
      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: "ea555d8a-9db1-4129-8221-6b125b3b7d5a"

    external_reference:
      description: reference id - user-defined external id for face/event.
      type: string
      maxLength: 36
      example: 2xQ2gprbMUePw1s9gw9fvA

    match_faces_result:
      type: array
      items:
        type: object
        properties:
          reference:
            type: object
            description: reference object
            properties:
              id:
                anyOf:
                  - $ref: '#/components/schemas/uuid_reference'
                  - $ref: '#/components/schemas/external_reference'
                  - $ref: '#/components/schemas/track_id'
                description: reference id
              type:
                type: string
                enum: ["descriptor", "attribute", "event", "face", "face_external_id", "event_external_id", "event_track_id"]
                description: match reference type
              face_id:
                allOf:
                  - $ref: '#/components/schemas/face_id'
                description: reference face id if reference type is face_external_id
              event_id:
                allOf:
                  - $ref: '#/components/schemas/event_id'
                description: reference event id if reference type is one of (event_external_id, event_track_id)
            required: [id, type]
          matches:
            type: array
            minItems: 0
            description: reference vs candidates matches
            items:
              oneOf:
                - $ref: '#/components/schemas/face_match_result_item'
                - $ref: '#/components/schemas/event_match_result_item'
                - $ref: '#/components/schemas/attribute_match_result_item'
                - $ref: '#/components/schemas/matches_error'
        required: [reference, matches]
      description: list of matches

    match_bodies_result:
      type: array
      items:
        type: object
        properties:
          reference:
            type: object
            description: reference object
            properties:
              id:
                anyOf:
                  - $ref: '#/components/schemas/uuid_reference'
                  - $ref: '#/components/schemas/external_reference'
                  - $ref: '#/components/schemas/track_id'
                description: reference id
              type:
                type: string
                enum: ["descriptor", "event", "event_external_id", "event_track_id"]
                description: match reference type
              event_id:
                allOf:
                  - $ref: '#/components/schemas/event_id'
                description: reference event id if reference type is one of (event_external_id, event_track_id)
            required: [id, type]
          matches:
            type: array
            minItems: 0
            items:
              oneOf:
                - $ref: '#/components/schemas/event_match_result_item'
                - $ref: '#/components/schemas/matches_error'
            description: reference vs candidates matches
        required: [reference, matches]
      description: list of matches

    cross_match_face:
      type: object
      properties:
        references:
          oneOf:
            - $ref: '#/components/schemas/cross_match_face_filters'
            - $ref: '#/components/schemas/cross_match_event_filters'
            - $ref: '#/components/schemas/cross_match_attribute_filters'
          description: references for matching filters
        candidates:
          oneOf:
            - $ref: '#/components/schemas/cross_match_face_filters'
            - $ref: '#/components/schemas/cross_match_event_filters'
            - $ref: '#/components/schemas/cross_match_attribute_filters'
          description: candidates for matching filters
        limit:
          $ref: '#/components/schemas/cross_match_limit'
        threshold:
          $ref: '#/components/schemas/threshold'
      required: [references, candidates]

    cross_match_body:
      type: object
      properties:
        references:
          allOf:
            - $ref: '#/components/schemas/cross_match_event_filters'
          description: references for matching filters
        candidates:
          allOf:
            - $ref: '#/components/schemas/cross_match_event_filters'
          description: candidates for matching filters
        limit:
          $ref: '#/components/schemas/cross_match_limit'
        threshold:
          $ref: '#/components/schemas/threshold'
      required: [references, candidates]

    cross_match_result_error_reference:
      type: object
      properties:
        reference_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: reference id
        error:
          allOf:
            - $ref: '#/components/schemas/FaceError'
          description: mathcing error
      required: [reference_id, error]

    cross_match_result_error_candidate:
      type: object
      properties:
        candidate_id:
          allOf:
            - $ref: '#/components/schemas/uuid'
          description: candidate id
        error:
          allOf:
            - $ref: '#/components/schemas/FaceError'
          description: matching error
      required: [candidate_id, error]

    cross_match_result_matches_schema:
      type: array
      items:
        type: object
        properties:
          reference_id:
            allOf:
              - $ref: '#/components/schemas/uuid'
            description: reference id
          candidate_ids:
            type: array
            description: candidate IDs
            items:
              type: string
              format: binary
              example: \xbb\xb3V\x8f7\xb1D\xb7\x821\xeb\xebH3^.
              description: UUID bytes
            minItems: 0
          similarity:
            type: array
            description: candidate similarities in relation to the reference
            items:
              $ref: '#/components/schemas/similarity'
            minItems: 0
        required: [ reference_id, candidate_ids, similarity ]
      minItems: 0
      description: match results with references ordered by lexicographic similarities of candidates

    cross_match_result_errors_schema:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/cross_match_result_error_reference'
          - $ref: '#/components/schemas/cross_match_result_error_candidate'
        description: matching errors
      minItems: 0
      description: matching errors list

    cross_match_face_result:
      type: object
      properties:
        request:
          type: object
          properties:
            candidates:
              oneOf:
                - $ref: '#/components/schemas/cross_match_face_filters'
                - $ref: '#/components/schemas/cross_match_event_filters'
                - $ref: '#/components/schemas/cross_match_attribute_filters'
              description: candidate filters
            references:
              oneOf:
                - $ref: '#/components/schemas/cross_match_face_filters'
                - $ref: '#/components/schemas/cross_match_event_filters'
                - $ref: '#/components/schemas/cross_match_attribute_filters'
              description: reference filters
            limit:
              $ref: '#/components/schemas/limit'
            threshold:
              $ref: '#/components/schemas/threshold'
          description: filters from request
          required: [candidates, references, limit, threshold]
        matches:
          $ref: '#/components/schemas/cross_match_result_matches_schema'
        errors:
          $ref: '#/components/schemas/cross_match_result_errors_schema'
      required: [request, matches, errors]

    cross_match_body_result:
      type: object
      properties:
        request:
          type: object
          properties:
            candidates:
              allOf:
                - $ref: '#/components/schemas/cross_match_event_filters'
              description: candidate filters
            references:
              allOf:
                - $ref: '#/components/schemas/cross_match_event_filters'
              description: reference filters
            limit:
              $ref: '#/components/schemas/limit'
            threshold:
              $ref: '#/components/schemas/threshold'
          description: filters from request
          required: [candidates, references, limit, threshold]
        matches:
          $ref: '#/components/schemas/cross_match_result_matches_schema'
        errors:
          $ref: '#/components/schemas/cross_match_result_errors_schema'
      required: [request, matches, errors]

    face_descriptor_data_binary:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: binary
          description: raw descriptor
        version:
          $ref: '#/components/schemas/face_descriptor_version'
      required: [ descriptor, version ]

    body_descriptor_data_binary:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: binary
          description: raw descriptor
        version:
          $ref: '#/components/schemas/body_descriptor_version'
      required: [ descriptor, version ]

    descriptor_data_binary:
      type: object
      description: descriptor and descriptor version
      properties:
        descriptor:
          type: string
          format: binary
          description: raw descriptor
        version:
          oneOf:
          - $ref: '#/components/schemas/face_descriptor_version'
          - $ref: '#/components/schemas/body_descriptor_version'
      required: [descriptor, version]

    xpk_file_binary:
      type: string
      format: binary
      description: xpk file

    sdk_descriptor_binary:
      type: string
      format: binary
      description: luna sdk descriptor in bytes. The descriptor version, a signuture and descriptor.

    identification_id:
      allOf:
      - $ref: '#/components/schemas/common_id'
      - description:  id for identification in the match results

    raw_face_descriptor_entity:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: [ "raw_descriptor" ]
        data:
          $ref: '#/components/schemas/face_descriptor_data'
      required: [ id, type, data ]

    raw_body_descriptor_entity:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: [ "raw_descriptor" ]
        data:
          $ref: '#/components/schemas/body_descriptor_data'
      required: [ id, type, data ]

    raw_descriptor_entity:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["raw_descriptor"]
        data:
          $ref: '#/components/schemas/descriptor_data'
      required: [id, type, data]

    sdk_descriptor_entity:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["sdk_descriptor"]
        data:
          $ref: '#/components/schemas/sdk_descriptor'
      required: [id, type, data]

    xpk_file_entity:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["xpk_file"]
        data:
          $ref: '#/components/schemas/xpk_file'
      required: [id, type, data]

    raw_face_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: [ "raw_descriptor" ]
        data:
          $ref: '#/components/schemas/face_descriptor_data_binary'
      required: [ id, type, data ]

    raw_body_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: [ "raw_descriptor" ]
        data:
          $ref: '#/components/schemas/body_descriptor_data_binary'
      required: [ id, type, data ]

    raw_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["raw_descriptor"]
        data:
          $ref: '#/components/schemas/descriptor_data'
      required: [id, type, data]

    sdk_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["sdk_descriptor"]
        data:
          $ref: '#/components/schemas/sdk_descriptor_binary'
      required: [id, type, data]

    xpk_file_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["xpk_file"]
        data:
          $ref: '#/components/schemas/xpk_file_binary'
      required: [id, type, data]

    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:
            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: attributes_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: faces_db
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0
            status: 1
          - component: events_db
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0
            status: 1

    raw_match_response:
      type: object
      properties:
        matches:
          type: array
          minItems: 1
          items:
            type: object
            properties:
              reference_id:
                oneOf:
                  - $ref: '#/components/schemas/uuid_reference'
                  - $ref: '#/components/schemas/external_reference'
                description: reference id
              matches:
                type: array
                items:
                  description: sorted list with success match result for the *reference_id* vs candidate batch.
                  type: object
                  properties:
                    candidate_id:
                      oneOf:
                        - $ref: '#/components/schemas/uuid_reference'
                        - $ref: '#/components/schemas/external_reference'
                      description: candidate id
                    similarity:
                      $ref: '#/components/schemas/similarity'
                minItems: 1
                description: reference vs candidates matches
            required: [ reference_id, matches ]
          description: list of matches

    plugin_status:
      type: object
      properties:
        name:
          type: string
          description: Plugin name
        running:
          type: integer
          enum: [0, 1]
          description: Whether plugin is running or not.
      required: [name, running]

    plugins:
      type: object
      properties:
        plugins:
          description: list of imported plugins
          type: array
          items:
            $ref: '#/components/schemas/plugin_status'
      required: [plugins]
      example:
        plugins:
          - name: foo
            running: 1
  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'

    forbidden_error:
      description: forbidden, user did not set header Luna-Account-Id.
      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: 11036
            desc: Forbidden
            detail: Luna-Account-Id header is required for requests that change the state of system
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11036
    forbidden_events_error:
      description: forbidden, luna-events support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11040
            desc: Forbidden
            detail: Luna Events service is disabled
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11040
    forbidden_tasks_error:
      description: forbidden, luna-tasks support is disabled on server
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11039
            desc: Forbidden
            detail: Luna Tasks service is disabled
            link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11039

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

    forbidden_resource_error:
      description: Forbidden.
      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:
            resource_is_disabled:
              value:
                error_code: 12049
                desc: Forbidden
                detail: Resource is disabled.
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12049"
paths:
  /version:
    get:
      tags:
      - version

      summary: get version
      description: get service version
      operationId: getVersion

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/matcher/faces:
    post:
      tags:
      - matcher
      summary: face matching
      description: |
        Matcher API allows to submit tasks to a service that searches for faces similar to a given reference(s) by
        matching them. A face attribute descriptor should be extracted for reference(s) and candidate(s).

        The sources for references are events, attributes, faces or binary descriptor. The sources for candidates are
        faces, events or attributes.
      operationId: matchFaces
      parameters:
      - $ref: '#/components/parameters/json_or_msgpack_content'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/accept_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/match_faces_request_json'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/match_faces_request_msgpack'
        required: true
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack_content'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/match_faces_result'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/match_faces_result'
        400:
          description: Bad request
          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:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''candidates'',  message: ''candidates must contain [''type'', ''ids''] properties'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: 'Bad query parameters ''limit'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
                bad_target_to_get_faces:
                  value:
                    error_code: 22016
                    desc: Bad input data
                    detail: '''invalid'' is not valid target to get faces. Valid target should be one of [''face_id'', ''account_id'', ''event_id'', ''user_data'', ''create_time'', ''external_id'', ''avatar'', ''lists'',].'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22016
                bad_base64_for_one_descriptor:
                  value:
                    error_code: 18001
                    desc: Bad/incomplete input data
                    detail: Failed convert data from base64 to bytes
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-18001
                wrong_descriptors_length:
                  value:
                    error_code: 12034
                    desc: Bad/incomplete input data
                    detail: Descriptor has incorrect length 200
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12034
                bad_xpk_file:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: Failed to parse xpk file
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12035
                bad_sdk_descripot:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: SDK descriptor is not valid
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12038
                xpk_does_not_contain_descriptor:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: XPK file does not contain descriptor
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037
                unknown_descriptor_version:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: Descriptor version 37 are not registered in the system
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037
            application/msgpack:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''candidates'',  message: ''candidates must contain [''type'', ''ids''] properties'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/matcher/bodies:
    post:
      tags:
      - matcher
      summary: human body matching
      description: |
        Matcher API allows to submit tasks to a service that searches for human bodies similar to a given reference(s) by
        matching them. A body attribute descriptor should be extracted for reference(s) and candidate(s).

        The sources for references are events or binary descriptor. The sources for candidates is events.
      operationId: matchBodies
      parameters:
      - $ref: '#/components/parameters/json_or_msgpack_content'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/accept_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/match_bodies_request_json'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/match_bodies_request_msgpack'
        required: true
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack_content'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/match_bodies_result'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/match_bodies_result'
        400:
          description: Bad request
          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:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''candidates'',  message: ''candidates must contain [''type'', ''ids''] properties'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'limit'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
                bad_target_to_get_faces:
                  value:
                    error_code: 22016
                    desc: Bad input data
                    detail: '''invalid'' is not valid target to get faces. Valid target should be one of [''face_id'', ''account_id'', ''event_id'', ''user_data'', ''create_time'', ''external_id'', ''avatar'', ''lists'',].'
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22016
                bad_base64_for_one_descriptor:
                  value:
                    error_code: 18001
                    desc: Bad/incomplete input data
                    detail: Failed convert data from base64 to bytes
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-18001
                wrong_descriptors_length:
                  value:
                    error_code: 12034
                    desc: Bad/incomplete input data
                    detail: Descriptor has incorrect length 200
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12034
                bad_xpk_file:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: Failed to parse xpk file
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12035
                bad_sdk_descripot:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: SDK descriptor is not valid
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12038
                xpk_does_not_contain_descriptor:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: XPK file does not contain descriptor
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037
                unknown_descriptor_version:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: Descriptor version 37 are not registered in the system
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037
            application/msgpack:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: ''candidates'',  message: ''candidates must contain [''type'', ''ids''] properties'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/matcher/raw:
    post:
      tags:
      - matcher
      summary: raw matching
      description: |
        Matcher raw API allows to do similarity calculations for input descriptors.
      operationId: matchingRaw
      parameters:
      - $ref: '#/components/parameters/json_or_msgpack_content'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/accept_json_or_msgpack_content'
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                references:
                  type: array
                  items:
                    oneOf:
                      - $ref: '#/components/schemas/xpk_file_entity'
                      - $ref: '#/components/schemas/sdk_descriptor_entity'
                      - $ref: '#/components/schemas/raw_descriptor_entity'
                  description: reference list for matching
                  minItems: 1
                candidates:
                  type: array
                  items:
                    oneOf:
                      - $ref: '#/components/schemas/xpk_file_entity'
                      - $ref: '#/components/schemas/sdk_descriptor_entity'
                      - $ref: '#/components/schemas/raw_descriptor_entity'
                  minItems: 1
                  description: candidates for matching
              required: [references, candidates]
          application/msgpack:
            schema:
              type: object
              properties:
                references:
                  type: array
                  items:
                    oneOf:
                      - $ref: '#/components/schemas/xpk_file_entity_binary'
                      - $ref: '#/components/schemas/sdk_descriptor_entity_binary'
                      - $ref: '#/components/schemas/raw_descriptor_entity_binary'
                  description: reference list for matching
                  minItems: 1
                candidates:
                  type: array
                  items:
                    oneOf:
                      - $ref: '#/components/schemas/xpk_file_entity_binary'
                      - $ref: '#/components/schemas/sdk_descriptor_entity_binary'
                      - $ref: '#/components/schemas/raw_descriptor_entity_binary'
                  minItems: 1
                  description: candidates for matching
              required: [references, candidates]
        required: true
      responses:
        201:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/json_or_msgpack_content'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/raw_match_response'
            application/msgpack:
              schema:
                $ref: '#/components/schemas/raw_match_response'
        400:
          description: Bad request
          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:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''candidates'',  message: ''candidates must contain [''type'', ''ids''] properties'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: 'Bad query parameters ''limit'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012
                bad_base64_for_one_descriptor:
                  value:
                    error_code: 18001
                    desc: Bad/incomplete input data
                    detail: Failed convert data from base64 to bytes
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-19001
                wrong_descriptors_length:
                  value:
                    error_code: 12034
                    desc: Bad/incomplete input data
                    detail: Descriptor has incorrect length 200
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12034
                bad_xpk_file:
                  value:
                    error_code: 12035
                    desc: Bad/incomplete input data
                    detail: Failed to parse xpk file
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12035
                bad_sdk_descripot:
                  value:
                    error_code: 12038
                    desc: Bad/incomplete input data
                    detail: SDK descriptor is not valid
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12038
                xpk_does_not_contain_descriptor:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: XPK file does not contain descriptor
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037
                unknown_descriptor_version:
                  value:
                    error_code: 12037
                    desc: Bad/incomplete input data
                    detail: Descriptor version 37 are not registered in the system
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12037
            application/msgpack:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_msgpack:
                  value:
                    error_code: 12047
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input msgpack. Path: ''candidates'',  message: ''candidates must contain [''type'', ''ids''] properties'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12047
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/crossmatcher/faces:
    post:
      tags:
      - crossmatcher
      summary: cross matching faces
      description: |
        Cross Matcher API allows to submit tasks to a service that searches for faces/events by given filters and
        match all of them one with the other. Limit for references and canidates for each matching is 100000 objects.
      operationId: faceCrossMatching
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/crossmatch_sorting'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cross_match_face'
        required: true
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/application_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/msgpack:
              schema:
                $ref: '#/components/schemas/cross_match_face_result'
        400:
          description: Bad request
          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:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''references'',  message: ''references cannot be validated by any definition'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                different_accounts:
                  value:
                    error_code: 31000
                    desc: Bad/incomplete input data
                    detail: Account id from query parameters does not match the one from candidates filters
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-31000
                limit_exceeded:
                  value:
                    error_code: 31002
                    desc: Bad/incomplete input data
                    detail: Cross-matching filters presume too many received objects. Current general limit - 100000
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-31002
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/crossmatcher/bodies:
    post:
      tags:
      - crossmatcher
      summary: cross matching bodies
      description: |
        Cross Matcher API allows to submit tasks to a service that searches for faces/events by given filters and
        match all of them one with the other. Limit for references and canidates for each matching is 100000 objects.
      operationId: bodyCrossMatching
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/crossmatch_sorting'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/cross_match_body'
        required: true
      responses:
        200:
          description: Ok
          headers:
            Content-Type:
              $ref: '#/components/headers/application_msgpack'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/msgpack:
              schema:
                $ref: '#/components/schemas/cross_match_body_result'
        400:
          description: Bad request
          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:
                bad_content_type:
                  value:
                    error_code: 12017
                    desc: Bad/incomplete input data
                    detail: Bad content type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12017
                bad_json:
                  value:
                    error_code: 12022
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Path: ''references'',  message: ''references cannot be validated by any definition'''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022
                different_accounts:
                  value:
                    error_code: 31000
                    desc: Bad/incomplete input data
                    detail: Account id from query parameters does not match the one from candidates filters
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-31000
                limit_exceeded:
                  value:
                    error_code: 31002
                    desc: Bad/incomplete input data
                    detail: Cross-matching filters presume too many received objects. Current general limit - 100000
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-31002
        403:
          $ref: '#/components/responses/forbidden_events_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/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'
  /1/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'
  /1/config:
    get:
      tags:
        - config
      summary: get service configuration
      description: Get service configuration. Passwords and tokens will be hidden in the response.
      operationId: getConfig

      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/accept_config_handler'
      responses:
        200:
          description: OK
          headers:
            Content-Type:
              $ref: '#/components/headers/config_accept_content_type'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                description: json format configuration
              example:
                INFLUX_MONITORING:
                  SEND_DATA_FOR_MONITORING: 0
                  VERSION: 2
                  ORGANIZATION: ORGANIZATION_NAME
                  TOKEN: '********'
                  BUCKET: luna_monitoring
                  HOST: 127.0.0.1
                  PORT: 8086
                  USE_SSL: 0
                  FLUSHING_PERIOD: 1.0
            text/plain:
              schema:
                type: string
                description: text format configuration
              example: |
                [INFLUX_MONITORING]
                SEND_DATA_FOR_MONITORING = 0
                VERSION = 2
                ORGANIZATION = ORGANIZATION_NAME
                TOKEN = ********
                BUCKET = luna_monitoring
                HOST = 127.0.0.1
                PORT = 8086
                USE_SSL = 0
                FLUSHING_PERIOD = 1.0
        415:
          description: Unsupported Media Type
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                unsupported_media_type:
                  value:
                    error_code: 12024
                    detail: Bad/incomplete input data
                    desc: Unsupported media type
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11024
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/plugins:
    get:
      tags:
        - plugins
      summary: get list of plugins
      description: |
        Get list of service plugins
      operationId: getPlugins
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/plugins'
        500:
          $ref: '#/components/responses/internal_server_error'
  /metrics:

    get:
      tags:
        - metrics
      summary: get service requests statistics
      description: Get statistics of success and failed requests to the service in prometheus format.
      operationId: metrics
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              schema:
                type: string
                enum:
                  - text/plain; charset=UTF-8
              required: true
              description: Content type is `text/plain`.
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            text/plain:
              schema:
                type: string
                description: Prometheus plain text format.
              example: |
                # HELP request_count_total Counter of requests
                # TYPE request_count_total counter
                request_count_total{path="GET:/healthcheck",status_code="200"} 1.0
        403:
          $ref: '#/components/responses/forbidden_resource_error'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_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'
