OpenApi

View spec in html.

openapi: 3.0.0
info:
  version: 'v.3.13.0'
  title: 'Luna-Handlers'
  description: 'VisionLabs Luna Handlers API'

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


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

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

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

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

    cache_handler_version:
      schema:
        type: string
        format: date-time
      description: If handler from cache is used, this field contains version of the handler.

    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: Page number.

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

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

    tags:
      in: query
      name: tags
      schema:
        type: array
        items:
          $ref: '#/components/schemas/tag'
        minItems: 0
      explode: false
      description: |
        A comma-separated list of tags. Each event from result will contain all of the given tags.
        Each tag can be at most 36 characters.
      example:
        - tag_1
        - tag_2

    city:
      in: query
      name: city
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event city.
      example: "New-York"

    area:
      in: query
      name: area
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event area.
      example: "central park"

    district:
      in: query
      name: district
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event district.
      example: "mitino"

    street:
      in: query
      name: street
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event street.
      example: "arbat"

    house_number:
      in: query
      name: house_number
      schema:
        $ref: '#/components/schemas/location_str'
      description: Event house number.
      example: "1/2str3"

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

    detector_multiface_policy:
      in: query
      name: multiface_policy
      schema:
        $ref: '#/components/schemas/multiface_policy'
      description: |
        Multiple face detection policy:

        - *`0`* - multiple face detection not allowed

        - *`1`* - multiple face detection allowed

        - *`2`* - get best face detection from the image

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

    estimate_emotions:
      in: query
      name: estimate_emotions
      schema:
        $ref: '#/components/schemas/int01_def0'
      description: |
        Whether to estimate emotions on the image.

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

    extract_exif:
      in: query
      name: extract_exif
      schema:
        $ref: '#/components/schemas/extract_exif'
      description: |
        Whether to extract EXIF meta information from input JPEG images.

        Exact output will vary since there are no mandatory requirements for both authoring software and digital cameras how to write the data.

        This function will only parse the tags and output their names and values as they are. Please refer to JEITA CP-3451 EXIF specification for details.

    estimate_quality:
      in: query
      name: estimate_quality
      schema:
        $ref: '#/components/schemas/estimate_quality'
      description: |
        Whether to estimate input face image quality.

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

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

    estimate_mouth_attributes:
      in: query
      name: estimate_mouth_attributes
      schema:
        $ref: '#/components/schemas/estimate_mouth_attributes'
      description: |
        Whether to estimate mouth attributes on the image.

    estimate_mask:
      in: query
      name: estimate_mask
      schema:
        $ref: '#/components/schemas/estimate_mask'
      description: |
        Whether to estimate mask on the image.

    pitch_threshold:
      in: query
      name: pitch_threshold
      schema:
        $ref: '#/components/schemas/pitch_threshold'
      description: |
        Maximum deviation pitch angle from 0.

    roll_threshold:
      in: query
      name: roll_threshold
      schema:
        $ref: '#/components/schemas/roll_threshold'
      description: |
        Maximum deviation roll angle from 0.

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

      description: |
        Maximum deviation yaw angle from 0.

    extract_descriptor:
      in: query
      name: extract_descriptor
      schema:
        allOf:
        - $ref: '#/components/schemas/extract_descriptor'
        - default: 1

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

      description: |
          Whether to aggregate face descriptor(s).

          If true, all extracted attributes will be aggregated and stored as a single attribute.
          Otherwise, all attributes will be stored for each sample.

    extract_basic_attributes:
      in: query
      name: extract_basic_attributes
      schema:
        $ref: '#/components/schemas/extract_basic_attributes'
      description: |
        Whether to extract basic attributes (gender, age, ethnicity).

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

    warped_image:
      in: query
      name: warped_image
      schema:
        $ref: '#/components/schemas/warped_image'
      description: Whether input image is a warped or arbitrary image.

    luna_event_time:
      in: header
      name: Luna-Event-Time
      schema:
        $ref: '#/components/schemas/time'
      examples:
        with_time_zone:
          summary: time with timezone
          value: "2018-12-16T15:29:59.300275+03:00"
        utc:
          summary: utc time
          value: "2018-12-16T15:29:59.300275Z"
      description: |
        User defined event time. All events will be saved with this time as "create_time". Format of time is
        [rfc3339](https://www.ietf.org/rfc/rfc3339.txt). All other format is ignored.

    luna_event_end_time:
      in: header
      name: Luna-Event-End-Time
      schema:
        $ref: '#/components/schemas/time'
      examples:
        with_time_zone:
          summary: time with timezone
          value: "2018-12-16T15:29:59.300275+03:00"
        utc:
          summary: utc time
          value: "2018-12-16T15:29:59.300275Z"
      description: |
        User defined event end time. All events will be saved with this time as "end_time". Format of time is
        [rfc3339](https://www.ietf.org/rfc/rfc3339.txt). All other format is ignored.

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

    account_id_required:
      in: query
      name: account_id
      schema:
        $ref: '#/components/schemas/uuid'
      description: Account ID.
      required: true
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb'

    handler_type:
      in: query
      name: handler_type
      schema:
        type: integer
        enum: [ 0, 1, 2]
      description: | 
        Whether to get only non-dynamic (0), dynamic (1) or lambda (2) handlers.
        
        If type is non-dynamic:
          - Handler will use policies what assigned to it.
        
        If type is dynamic:
          - Handler will use given policies for each event generation request.
        
        If type is lambda:
          - All requests will be sent to lambda handler using `lambda_id`.
          - The format of the request and response body may not match what is specified for canonical handlers.
          - Logic of the request behavior completely depends on the lambda, written by the user.
          - For a description, see documentation of the lambda, for example via luna-lambda service.
      required: false

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

    longitude:
      in: query
      name: longitude
      schema:
        type: number
        minimum: -180
        maximum: 180
      description: |
        Longitude in degrees, a part of composite geo position.
        Geo position is considered as properly specified if both *longitude* and *latitude* are set.
      example: 36.616

    latitude:
      in: query
      name: latitude
      schema:
        type: number
        minimum: -90
        maximum: 90
      description: |
        Latitude in degrees, a part of composite geo position.
        Geo position is considered as properly specified if both *longitude* and *latitude* are set.
      example: 55.752

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

    raw_or_face_image_type:
      in: query
      name: image_type
      schema:
        type: integer
        default: 0
        enum: [0,1]
        description: Image type of input image.  0 - raw image, 1 - face warped image.

    ttl:
      in: query
      name: ttl
      schema:
        type: integer
        default: 300
        maximum: 86400
        minimum: 1
      description: Lifetime for temporary attribute (seconds).

    source:
      in: query
      name: source
      schema:
        $ref: '#/components/schemas/source'
      description: Additional information, provided by user with event.
      example: "3rd Avenue"

    stream_id:
      in: query
      name: stream_id
      schema:
        $ref: '#/components/schemas/stream_id'
      description: Stream id.
      example: "8950722f-3fd4-4223-b48f-03f95f0e8dfb"

    verifier_description:
      in: query
      name: description
      schema:
        type: string
      description: Verifier description - verifiers with description similar to this parameter will be processed.

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

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

    face_ids:
      in: query
      name: face_ids
      schema:
        type: string
        format: list of uuid.
      description: List of face IDs
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'

    event_ids:
      in: query
      name: event_ids
      schema:
        type: string
        format: list of uuid.
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'
      description: List of comma-separated event IDs.

    external_ids:
      in: query
      name: external_ids
      schema:
        type: string
      example: 'abcd_1234,346a5645-ec89-4806-820a-dbcb6e0dc38'
      description: List of comma-separated external IDs.

    attribute_ids:
      in: query
      name: attribute_ids
      schema:
        type: string
        format: list of uuid
      example: '8950722f-3fd4-4223-b48f-03f95f0e8dfb,346a5645-ec89-4806-820a-dbcb6e0dc38'
      description: List of comma-separated attribute IDs.

    track_id:
      in: query
      name: track_id
      schema:
        type: string
        pattern: '^[a-zA-Z0-9_\-](1, 36)$'
      description: Event track ID.
      example: "useful_track_id_number_1"

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

    estimate_face_quality:
      in: query
      name: estimate_face_quality
      schema:
        type: integer
        enum: [0, 1]
        default: 0
      description: |
        Whether to estimate face quality.

        It enables you to perform various face quality checks by thresholds which similar to ISO standard.
        For more information on the requirements for face attributes in the image, see [ISO/IEC 19794-5 Clauses 7-10](https://www.iso.org/obp/ui/#iso:std:iso-iec:19794:-5:en).

        ⚠ **ISO licensing feature is required to be enabled to perform face quality estimation.**
      example: 0

    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.

    wait_raw_event_saving:
      in: query
      name: wait_saving
      schema:
        type: integer
        enum: [0, 1]
        default: 1
      description: |
        Whether to wait for raw event saving.

        If "0" is specified, the 202 status code will be expected in response to a successful request.
        This status code is returned after event are validated and added to the buffer.
        The system does not wait until the event are saved to the database.
        The event will be stored in the database after the response is sent.

        If "1" is specified, the 201 status code will be expected in response to a successful request.
        This status code is returned only after event are stored in the database.

    no_cache:
      in: query
      name: no_cache
      schema:
        type: integer
        enum: [0, 1]
        default: 0
      description: Flag to disable handler caching.

    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.

    luna_account_id_required:
      name: Luna-Account-Id
      in: header
      schema:
        $ref: "#/components/schemas/account_id"
      description: Luna account Id. Designed to identify the created object.
      required: true

    luna_account_id_non_required:
      name: Luna-Account-Id
      in: header
      schema:
        $ref: "#/components/schemas/account_id"
      description: Luna account Id. Designed to identify the created object.
      required: false
  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: 11009
        detail: Internal server error
        desc: Internal server error
        link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11009

    common_id:
      description: User-defined ID.
      type: string
      maxLength: 36
      example: "3.1415926"

    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"

    tag:
      type: string
      example: "good"
      maxLength: 36

    attribute_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      - nullable: true
      - description: Attribute ID. Will be null if not stored.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

    sample_id:
      allOf:
      - $ref: '#/components/schemas/uuid'
      - nullable: true
      - description: Sample ID. Will be null if not stored.
      example: "b668c4a5-2191-476e-a261-3b4f9ce2e25e"

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

    field_external_id:
      description: User-defined external ID.
      type: string
      default: ""
      maxLength: 36
      example: "b668c4a5-2191-some-important-words"

    face_external_id:
      description: Face external ID.
      allOf:
      - $ref: '#/components/schemas/field_external_id'

    event_external_id:
      description: Event external ID.
      allOf:
      - $ref: '#/components/schemas/field_external_id'

    filter_external_id:
      description: Objects whose `external_id` values are not equal to the filter will be filtered.
      type: string
      maxLength: 36
      example: "b668c4a5-2191-some-important-words"

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

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

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

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

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

    face_avatar:
      type: string
      format: uri-reference
      default: ""
      maxLength: 256
      description: Avatar for the face, references to a sample or a user-defined reference.

    input_url:
      type: string
      format: uri-reference
      description: URL.

    count:
      type: integer
      minimum: 0
      description: Object count.
      example: 100

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

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

    int02:
      type: integer
      default: 1
      enum: [0,1,2]

    int0100:
      type: integer
      minimum: 0
      maximum: 100

    int0180:
      type: integer
      minimum: 0
      maximum: 180

    number01:
      type: number
      minimum: 0
      maximum: 1

    sdk_descriptor:
      type: string
      format: byte
      description: SDK descriptor (descriptor version, signature, descriptor bytes).

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

    location_str:
      type: string
      maxLength: 36

    longitude:
      type: number
      minimum: -180
      maximum: 180
      description: Longitude in degrees.
      example: 36.616

    latitude:
      type: number
      minimum: -90
      maximum: 90
      description: Latitude in degrees.
      example: 55.752

    angle:
      type: float
      minimum: -180
      maximum: 180
      description: angle
      example: 90.101

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

    house_number:
      allOf:
      - $ref: '#/components/schemas/location_str'
      - description: House number where event is incidented.
    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.

    location:
      type: object
      description: Information about a place where event is incidented.
      properties:
        city:
          allOf:
          - $ref: '#/components/schemas/city'
          - nullable: true
        area:
          allOf:
          - $ref: '#/components/schemas/area'
          - nullable: true
        district:
          allOf:
          - $ref: '#/components/schemas/district'
          - nullable: true
        street:
          allOf:
          - $ref: '#/components/schemas/street'
          - nullable: true
        house_number:
          allOf:
          - $ref: '#/components/schemas/house_number'
          - nullable: true
        geo_position:
          allOf:
            - $ref: '#/components/schemas/geo_position'
            - nullable: true

    input_location:
      type: object
      description: Information about a place where event is incidented.
      properties:
        city:
          $ref: '#/components/schemas/city'
        area:
          $ref: '#/components/schemas/area'
        district:
          $ref: '#/components/schemas/district'
        street:
          $ref: '#/components/schemas/street'
        house_number:
          $ref: '#/components/schemas/house_number'
        geo_position:
          $ref: '#/components/schemas/geo_position'

    multiface_policy:
      allOf:
        - $ref: '#/components/schemas/int02'
        - type: integer
        - description: |
            Multiple face detection policy:

            - *`0`* - do not process images with several detected faces.

              If *`detect_body`* is enabled, the system will attempt to detect a human body related to the detected face. If a human body is detected, its detection will be associated with the same event as the face.

              If there is no face detected in the image, no human body detections will be returned. Thus there will be no human body detection returned if *`detect_face`* is disabled.


            - *`1`* - process images with several detected faces and/or human bodies.

              If *`detect_body`* is enabled, all the detections of human bodies will be returned. Face detection and human body detection of the same person will be associated with the same event.

              The detections of human bodies are returned even if there were no faces found.


            - *`2`* - get the best face detection from the image. A single face of the best quality is detected in the image.

              If *`detect_body`* is enabled, the system will attempt to detect a human body related to the detected face. If a human body is detected, its detection will be associated with the same event as the face.

              If there is no face detected in the image, no human body detections will be returned. Thus there will be no human body detection returned if *`detect_face`* is disabled.

    estimate_head_pose:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      description: |
        Whether to estimate head pose on the image.

        *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    estimate_emotions:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to estimate emotions on the image.

    estimate_quality:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to estimate input face image quality.

    estimate_gaze:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to estimate eye gaze on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    estimate_eyes_attributes:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to estimate eye attributes on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    estimate_mouth_attributes:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to estimate mouth attributes on the image.

    estimate_mask:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - description: |
          Whether to estimate mask on the image.

    estimate_glasses:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - description: |
          Whether to estimate glasses on the image.

    detect_landmarks68:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to detect basic 68-point facial landmarks on the image.

          *Not supported with warped images (see `warped_image` or `image_type` parameter).*

    extract_exif:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
      - description: |
          Whether to extract EXIF meta information from input images.

          Exact output will vary since there are no mandatory requirements to both authoring software and digital cameras how to write the data.

          This function will only parse the tags and output their names and values as is. Please refer to JEITA CP-3451 EXIF specification for details.

    pitch_threshold:
      allOf:
      - $ref: '#/components/schemas/int0180'
      - type: integer
      - description: |
          Maximum deviation pitch angle from 0.

    roll_threshold:
      allOf:
      - $ref: '#/components/schemas/int0180'
      - type: integer
      - description: |
          Maximum deviation roll angle from 0.

    yaw_threshold:
      allOf:
      - $ref: '#/components/schemas/int0180'
      - type: integer
      - description: |
          Maximum deviation yaw angle from 0.

    face_occlusion_states:
      type: array
      items:
        type: string
        enum: ["face", "forehead", "eye", "nose", "mouth", "lower_face"]
      minItems: 1
      description: |
        List of face area which must not be occluded. If any area are occluded on face then 
        face will be filtered. `face` means that `face_occlusion_score` must be lower than  
        corresponding threshold.
      example: ["face"]

    estimate_face_occlusion:
      type: object
      properties:
        estimate:
          allOf:
            - $ref: '#/components/schemas/int01_def0'
            - description: Whether to estimate liveness on the image.
          default: 0
        occlusion_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                Face occlusion threshold. If an face occlusion has area greater than this threshold than face
                is considered as occluded.
          default: 0.07
        hair_occlusion_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                The "hair_occlusion_threshold" sets the threshold for hair overlap. When hair overlap exceeds the 
                specified threshold, the value is included into the total face occlusion score and the forehead 
                occlusion score.  Othervise it is considered that face is not occluded by hair.
          default: 0.15
        forehead_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                Forehead occlusion threshold. If a forehead occlusion has area greater than this threshold than forehead
                is considered as occluded.
          default: 0.2
        eye_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                Eyes occlusion threshold.If occlusion of any eye has area greater than this threshold than eyes are 
                considered as occluded.
          default: 0.15
        nose_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                Nose occlusion threshold. If a nose occlusion has area greater than this threshold than nose
                is considered as occluded.
          default: 0.2
        mouth_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                Mouth occlusion threshold. If a mouth occlusion has area greater than this threshold than mouth
                is considered as occluded.
          default: 0.15
        lower_face_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: |
                Lower face occlusion threshold. If a lower face occlusion has area greater than this threshold than 
                lower face is considered as occluded.
          default: 0.2
    mask_states:
      type: array
      items:
        type: integer
        enum: [1, 2, 3]
      minItems: 1
      description: |
        Filter by mask states

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

    estimate_liveness:
      type: object
      properties:
        estimate:
          allOf:
            - $ref: '#/components/schemas/int01_def0'
            - description: Whether to estimate liveness on the image.
          default: 0
        liveness_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: Liveness estimation real score threshold.
          default: 0.5
        quality_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: Liveness estimation quality threshold. Support in backwards compatibility, never applied.
            - deprecated: true
          default: 0.5
      description: |
          Liveness estimation configuration.

          ⚠ **Liveness licensing feature is required to be enabled to perform liveness estimation.**

    liveness_states:
      type: array
      items:
        type: integer
        enum: [ 0, 1, 2 ]
      minItems: 1
      description: |
        Filter by liveness states. Only events with an estimated liveness state equal to one of the specified liveness states will be processed. Each event from the result will contain one of given liveness states.
        The filter value `unknown` is supported for backwards compatibility, but is never reachable for estimation result. Please manage to not use it for filtration.

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

    liveness_candidate_filter:
      type: array
      items:
        type: integer
        nullable: true
        enum: [ 0, 1, 2, null ]
      minItems: 1
      description: |
        Filter by liveness states. Each event from the matching result will contain one of given liveness states.

        | liveness   | value |
        |----------------|------|
        | spoof          | 0    |
        | real           | 1    |
        | unknown        | 2    |
        | not estimated  | null |

    estimate_deepfake:
      type: object
      properties:
        estimate:
          allOf:
            - $ref: '#/components/schemas/int01_def0'
            - description: Whether to estimate deepfake on the image.
          default: 0
        real_threshold:
          allOf:
            - $ref: '#/components/schemas/number01'
            - description: Deepfake estimation real score threshold.
          default: 0.5
        mode:
          type: integer
          enum: [ 1,2 ]
          default: 2
          description: Deepfake estimation mode.
      description: |
          Deepfake estimation configuration.

          ⚠ **Deepfake licensing feature is required to be enabled to perform deepfake estimation.**

    deepfake_states:
      type: array
      items:
        type: integer
        enum: [ 0, 1 ]
      minItems: 1
      description: |
        Filter by deepfake states. Only events with an estimated deepfake state equal to one of the specified deepfake states will be processed. Each event from the result will contain one of given deepfake states.

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

    deepfake_candidate_filter:
      type: array
      items:
        type: integer
        nullable: true
        enum: [ 0, 1, null ]
      minItems: 1
      description: |
        Filter by deepfake states. Each event from the matching result will contain one of given deepfake states.

        | deepfake   | value |
        |----------------|------|
        | fake           | 0    |
        | real           | 1    |
        | not estimated  | null |

    estimate_people_count:
      type: object
      description: |
        People count estimation policy.
        
        ⚠ **People counter licensing feature is required to be enabled to perform estimation.**
      properties:
        estimate:
          allOf:
          - $ref: '#/components/schemas/int01_def0'
          - description: Whether to estimate people count on the image.
        people_coordinates:
          allOf:
            - $ref: '#/components/schemas/int01'
            - description: Whether to return people coordinates.
            - default: 1

    detect_face:
      allOf:
        - $ref: '#/components/schemas/int01_def0'
        - default: 1
        - description: |
            Whether to detect faces from the image.

    detect_body:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01_def0'
        - description: |
            Whether to detect bodies from the image.

    extract_basic_attributes:
      allOf:
      - $ref: '#/components/schemas/int01_def0'
      - type: integer
        description: |
          Whether to extract basic attributes (gender, age, ethnicity).

    extract_descriptor:
      allOf:
      - default: 1
      - $ref: '#/components/schemas/int01_def0'
      - description: |
          Whether to extract face descriptor(s).

    extract_body_descriptor:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01_def0'
        - description: |
            Whether to extract body descriptor(s).

    aggregate_attributes:
      allOf:
      - type: integer
        enum: [0, 1]
        description: |
          Whether to aggregate attribute(s).

          If true, all extracted attributes will be aggregated and stored as a single attribute.
          Otherwise, all attributes will be stored for each sample.

    score_threshold:
      type: number
      minimum: 0
      maximum: 1
      example: 0.99
      default: 0
      description: |
        Face descriptor quality score threshold. All the attributes with quality score below the threshold will be
        ignored (and not stored in the DB). The function will proceed as usual with all the remaining descriptors
        (if left).

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

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

    object_user_data:
      description: User data associated with object.
      type: string
      maxLength: 128
      example: "some data"
      default: ""

    face_user_data:
      description: Face user data.
      allOf:
        - $ref: '#/components/schemas/object_user_data'

    event_user_data:
      description: Event user data.
      allOf:
        - $ref: '#/components/schemas/object_user_data'

    user_data_filter:
      description: Objects whose `user_data` values are not contain the filter will be filtered.
      type: string
      maxLength: 128
      example: "some data"

    handler_type:
      description: |
        Whether to get only non-dynamic (0), dynamic (1) or lambda (2) handlers.
        
        If type is non-dynamic:
          - Handler will use policies what assigned to it.
        
        If type is dynamic:
          - Handler will use given policies for each event generation request.
        
        If type is lambda:
          - All requests will be sent to lambda handler using `lambda_id`.
          - The format of the request and response body may not match what is specified for canonical handlers.
          - Logic of the request behavior completely depends on the lambda, written by the user.
          - For a description, see documentation of the lambda, for example via luna-lambda service.
      type: integer
      enum: [0, 1, 2]
      default: 0

    lambda_id:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: Id of lambda handler. Lambda handler it is user customizable handler.

    image_format_threshold:
      type: array
      items:
        type: string
        enum: [ JPEG, JPEG2000, PNG ]
      minItems: 1
      default: [ JPEG, JPEG2000, PNG ]
      description: List of allowed image formats.

    estimate_flag:
      type: integer
      enum: [0, 1]
      default: 1
      description: Whether to enable estimation.

    check_base:
      type: object
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'

    image_format_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/image_format_threshold'
        - description: Image format check.

    image_format_check_required:
      allOf:
        - $ref: '#/components/schemas/image_format_check'
        - required:
            - estimate
            - threshold

    base_float_min_threshold:
      type: number
      nullable: false
      description: Exclusive lower bound of the allowed range.
      example: 0.0

    base_float_max_threshold:
      type: number
      nullable: false
      description: Exclusive upper bound of the allowed range.
      example: 0.0

    base_int_min_threshold:
      type: integer
      nullable: false
      description: Exclusive lower bound of the allowed range.
      example: 0

    base_int_max_threshold:
      type: integer
      nullable: false
      description: Exclusive upper bound of the allowed range.
      example: 0

    base_int_max_threshold_nullable:
      type: integer
      nullable: true
      description: Exclusive upper bound of the allowed range.
      example: 0

    base_float_threshold:
      type: object
      description: Allowed range of the estimation value.

    check_threshold_inclusive_int_positive:
      type: object
      description: Allowed range of the estimation value.
      properties:
        min:
          allOf:
            - description: Inclusive lower bound of the allowed range.
            - $ref: '#/components/schemas/base_int_min_threshold'
            - minimum: 0
        max:
          allOf:
            - description: Inclusive upper bound of the allowed range.
            - $ref: '#/components/schemas/base_int_max_threshold'
            - nullable: true
            - minimum: 0

    check_threshold_inclusive_int_positive_max_nullable:
      type: object
      description: Allowed range of the estimation value.
      properties:
        min:
          allOf:
            - description: Inclusive lower bound of the allowed range.
            - $ref: '#/components/schemas/base_int_min_threshold'
            - minimum: 0
        max:
          allOf:
            - description: Inclusive upper bound of the allowed range.
            - $ref: '#/components/schemas/base_int_max_threshold_nullable'
            - minimum: 0

    check_threshold_float_0_1:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - $ref: '#/components/schemas/base_float_min_threshold'
                - minimum: 0.0
                - maximum: 1.0
            max:
              allOf:
                - $ref: '#/components/schemas/base_float_max_threshold'
                - minimum: 0.0
                - maximum: 1.0

    check_threshold_float_180_180:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - $ref: '#/components/schemas/base_float_min_threshold'
                - minimum: -180.0
                - maximum: 180.0
            max:
              allOf:
                - $ref: '#/components/schemas/base_float_max_threshold'
                - minimum: -180.0
                - maximum: 180.0

    check_threshold_float_positive:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - $ref: '#/components/schemas/base_float_min_threshold'
                - description: Inclusive lower bound of the allowed range.
                - minimum: 0.0
            max:
              allOf:
                - $ref: '#/components/schemas/base_float_max_threshold'
                - description: Inclusive upper bound of the allowed range.
                - minimum: 0.0
                - nullable: true

    check_threshold_float_positive_max_nullable:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - type: number
                - minimum: 0.0
                - description: Inclusive lower bound of the allowed range.
                - $ref: '#/components/schemas/base_float_min_threshold'
            max:
              allOf:
                - type: number
                - minimum: 0.0
                - nullable: true
                - description: Inclusive upper bound of the allowed range.
                - $ref: '#/components/schemas/base_float_min_threshold'

    illumination_quality_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.5
            max: 1.0
        - example:
            min: 0.3
            max: 0.9

    illumination_quality_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/illumination_quality_threshold'
        - description: Image quality check for uniformity of illumination.

    illumination_quality_check_required:
      allOf:
        - $ref: '#/components/schemas/illumination_quality_check'
        - required:
            - estimate
            - threshold

    specularity_quality_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.3
            max: 1.0
        - example:
            min: 0.3
            max: 0.9

    specularity_quality_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/specularity_quality_threshold'
        - description: Image quality check for specularity.

    specularity_quality_check_required:
      allOf:
        - $ref: '#/components/schemas/specularity_quality_check'
        - required:
            - estimate
            - threshold

    blurriness_quality_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.61
            max: 1.0
        - example:
            min: 0.3
            max: 0.9

    blurriness_quality_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/blurriness_quality_threshold'
        - description: Image quality check for blurriness.

    blurriness_quality_check_required:
      allOf:
        - $ref: '#/components/schemas/blurriness_quality_check'
        - required:
            - estimate
            - threshold

    dark_quality_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.5
            max: 1.0
        - example:
            min: 0.3
            max: 0.9

    dark_quality_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/dark_quality_threshold'
        - description: Image quality check for underexposure.

    dark_quality_check_required:
      allOf:
        - $ref: '#/components/schemas/dark_quality_check'
        - required:
            - estimate
            - threshold

    light_quality_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.57
            max: 1.0
        - example:
            min: 0.3
            max: 0.9

    light_quality_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/light_quality_threshold'
        - description: Image quality check for overexposure.

    light_quality_check_required:
      allOf:
        - $ref: '#/components/schemas/light_quality_check'
        - required:
            - estimate
            - threshold

    head_angles_threshold:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - description: Inclusive lower bound of the allowed range.
                - $ref: '#/components/schemas/base_float_min_threshold'
                - minimum: -180.0
                - maximum: 180.0
            max:
              allOf:
                - description: Inclusive upper bound of the allowed range.
                - $ref: '#/components/schemas/base_float_max_threshold'
                - minimum: -180.0
                - maximum: 180.0

    head_yaw_threshold:
      allOf:
        - $ref: '#/components/schemas/head_angles_threshold'
        - default:
            min: -5.0
            max: 5.0
        - example:
            min: 0.3
            max: 0.9

    head_yaw_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_yaw_threshold'
        - description: Head yaw check.

    head_yaw_check_required:
      allOf:
        - $ref: '#/components/schemas/head_yaw_check'
        - required:
            - estimate
            - threshold

    head_pitch_threshold:
      allOf:
        - $ref: '#/components/schemas/head_angles_threshold'
        - default:
            min: -5.0
            max: 5.0
        - example:
            min: 0.3
            max: 0.9

    head_pitch_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_pitch_threshold'
        - description: Head pitch check.

    head_pitch_check_required:
      allOf:
        - $ref: '#/components/schemas/head_pitch_check'
        - required:
            - estimate
            - threshold

    head_roll_threshold:
      allOf:
        - $ref: '#/components/schemas/head_angles_threshold'
        - default:
            min: -8.0
            max: 8.0
        - example:
            min: 0.3
            max: 0.9

    head_roll_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_roll_threshold'
        - description: Head roll check.

    head_roll_check_required:
      allOf:
        - $ref: '#/components/schemas/head_roll_check'
        - required:
            - estimate
            - threshold

    gaze_yaw_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_180_180'
        - default:
            min: -5.0
            max: 5.0
        - example:
            min: 0.3
            max: 0.9

    gaze_yaw_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/gaze_yaw_threshold'
        - description: Gaze yaw check.

    gaze_yaw_check_required:
      allOf:
        - $ref: '#/components/schemas/gaze_yaw_check'
        - required:
            - estimate
            - threshold

    gaze_pitch_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_180_180'
        - default:
            min: -5.0
            max: 5.0
        - example:
            min: 0.3
            max: 0.9

    gaze_pitch_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/gaze_pitch_threshold'
        - description: Gaze pitch check.

    gaze_pitch_check_required:
      allOf:
        - $ref: '#/components/schemas/gaze_pitch_check'
        - required:
            - estimate
            - threshold

    mouth_threshold:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - $ref: '#/components/schemas/base_float_min_threshold'
                - minimum: 0.0
                - maximum: 1.0
            max:
              allOf:
                - description: Inclusive upper bound of the allowed range.
                - $ref: '#/components/schemas/base_float_max_threshold'
                - minimum: 0.0
                - maximum: 1.0

    mouth_smiling_threshold:
      allOf:
        - $ref: '#/components/schemas/mouth_threshold'
        - default:
            min: 0.0
            max: 0.5
        - example:
            min: 0.3
            max: 0.9

    mouth_smiling_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/mouth_smiling_threshold'
        - description: Mouth smiling check.

    mouth_smiling_check_required:
      allOf:
        - $ref: '#/components/schemas/mouth_smiling_check'
        - required:
            - estimate
            - threshold

    mouth_occluded_threshold:
      allOf:
        - $ref: '#/components/schemas/mouth_threshold'
        - default:
            min: 0.0
            max: 0.5
        - example:
            min: 0.3
            max: 0.9

    mouth_occluded_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/mouth_occluded_threshold'
        - description: Mouth occluded check.

    mouth_occluded_check_required:
      allOf:
        - $ref: '#/components/schemas/mouth_occluded_check'
        - required:
            - estimate
            - threshold

    mouth_open_threshold:
      allOf:
        - $ref: '#/components/schemas/mouth_threshold'
        - default:
            min: 0.0
            max: 0.5
        - example:
            min: 0.3
            max: 0.9

    mouth_open_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/mouth_open_threshold'
        - description: Mouth open check.

    mouth_open_check_required:
      allOf:
        - $ref: '#/components/schemas/mouth_open_check'
        - required:
            - estimate
            - threshold

    glasses_threshold:
      type: array
      items:
        type: string
        enum: [ "no_glasses", "eyeglasses", "sunglasses" ]
      minItems: 1
      default: ["no_glasses", "eyeglasses"]
      description: List of image formats allowed by standard.

    glasses_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/glasses_threshold'
        - description: Glasses check.

    glasses_check_required:
      allOf:
        - $ref: '#/components/schemas/glasses_check'
        - required:
            - estimate
            - threshold

    eye_threshold:
      type: array
      items:
        type: string
        enum: [ "open", "occluded", "closed" ]
      minItems: 1
      default: ["open"]
      description: List of image formats allowed by standard.

    left_eye_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/eye_threshold'
        - description: Left eye check.

    left_eye_check_required:
      allOf:
        - $ref: '#/components/schemas/left_eye_check'
        - required:
            - estimate
            - threshold

    right_eye_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/eye_threshold'
        - description: Right eye check.

    right_eye_check_required:
      allOf:
        - $ref: '#/components/schemas/right_eye_check'
        - required:
            - estimate
            - threshold

    head_horizontal_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.45
            max: 0.55

    head_horizontal_center_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_horizontal_threshold'
        - description: Check for horizontal position of face center point relative to image | not available for warped images.

    head_horizontal_center_check_required:
      allOf:
        - $ref: '#/components/schemas/head_horizontal_center_check'
        - required:
            - estimate
            - threshold

    head_vertical_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.3
            max: 0.5

    head_vertical_center_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_vertical_threshold'
        - description: Check for vertical position of face center point relative to image | not available for warped images.

    head_vertical_center_check_required:
      allOf:
        - $ref: '#/components/schemas/head_vertical_center_check'
        - required:
            - estimate
            - threshold

    head_width_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_positive'
        - default:
            min: 0.5
            max: 0.75

    head_width_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_width_threshold'
        - description: Check for horizontal head size relative to image size | not available for warped images.

    head_width_check_required:
      allOf:
        - $ref: '#/components/schemas/head_width_check'
        - required:
            - estimate
            - threshold

    head_height_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_positive'
        - default:
            min: 0.6
            max: 0.9

    head_height_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/head_height_threshold'
        - description: Check for vertical head size relative to image size | not available for warped images.

    head_height_check_required:
      allOf:
        - $ref: '#/components/schemas/head_height_check'
        - required:
            - estimate
            - threshold

    eye_distance_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_positive_max_nullable'
        - default:
            min: 90.0
        - example:
            min: 91.1
            max: 92.2

    eye_distance_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/eye_distance_threshold'
        - description: Eye distance check | not available for warped images.

    eye_distance_check_required:
      allOf:
        - $ref: '#/components/schemas/eye_distance_check'
        - required:
            - estimate
            - threshold

    image_width_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive'
        - default:
            min: 180
            max: 1920

    image_width_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/image_width_threshold'
        - description: Image width check.

    image_width_check_required:
      allOf:
        - $ref: '#/components/schemas/image_width_check'
        - required:
            - estimate
            - threshold

    image_height_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive'
        - default:
            min: 180
            max: 1080

    image_height_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/image_height_threshold'
        - description: Image height check.

    image_height_check_required:
      allOf:
        - $ref: '#/components/schemas/image_height_check'
        - required:
            - estimate
            - threshold

    aspect_ratio_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_positive'
        - default:
            min: 0.74
            max: 0.8

    aspect_ratio_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/aspect_ratio_threshold'
        - description: Image aspect ratio check.

    aspect_ratio_check_required:
      allOf:
        - $ref: '#/components/schemas/aspect_ratio_check'
        - required:
            - estimate
            - threshold

    face_width_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive_max_nullable'
        - default:
            min: 180

    face_width_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/face_width_threshold'
        - description: Face width check | not available for warped images.

    face_width_check_required:
      allOf:
        - $ref: '#/components/schemas/face_height_check'
        - required:
            - estimate
            - threshold

    face_height_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive_max_nullable'
        - default:
            min: 180

    face_height_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/face_height_threshold'
        - description: Face height check | not available for warped images.

    face_height_check_required:
      allOf:
        - $ref: '#/components/schemas/face_height_check'
        - required:
            - estimate
            - threshold

    indent_left_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive_max_nullable'
        - default:
            min: 20

    indent_left_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/indent_left_threshold'
        - description: Check for indent from the left image border to the left face border | not available for warped images.

    indent_left_check_required:
      allOf:
        - $ref: '#/components/schemas/indent_left_check'
        - required:
            - estimate
            - threshold

    indent_right_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive_max_nullable'
        - default:
            min: 20

    indent_right_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/indent_right_threshold'
        - description: Check for indent from the right image border to the right face border | not available for warped images.

    indent_right_check_required:
      allOf:
        - $ref: '#/components/schemas/indent_right_check'
        - required:
            - estimate
            - threshold

    indent_upper_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive_max_nullable'
        - default:
            min: 20

    indent_upper_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/indent_upper_threshold'
        - description: Check for indent from the upper image border to the upper face border | not available for warped images.

    indent_upper_check_required:
      allOf:
        - $ref: '#/components/schemas/indent_upper_check'
        - required:
            - estimate
            - threshold

    indent_lower_threshold:
      allOf:
        - description: Allowed range of the estimation value (in pixels).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive_max_nullable'
        - default:
            min: 20

    indent_lower_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/indent_lower_threshold'
        - description: Check for indent from the lower image border to the lower face border | not available for warped images.

    indent_lower_check_required:
      allOf:
        - $ref: '#/components/schemas/indent_lower_check'
        - required:
            - estimate
            - threshold

    image_size_threshold:
      allOf:
        - description: Allowed range of the estimation value (in bytes).
        - $ref: '#/components/schemas/check_threshold_inclusive_int_positive'
        - default:
            min: 5120
            max: 2097152

    image_size_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/image_size_threshold'
        - description: Image size check.

    image_size_check_required:
      allOf:
        - $ref: '#/components/schemas/image_size_check'
        - required:
            - estimate
            - threshold

    illumination_uniformity_threshold:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - minimum: 0.0
                - maximum: 1.0
                - description: Inclusive lower bound of the allowed range.
                - $ref: '#/components/schemas/base_float_min_threshold'
            max:
              allOf:
                - minimum: 0.0
                - maximum: 1.0
                - description: Inclusive lower bound of the allowed range.
                - $ref: '#/components/schemas/base_float_max_threshold'
        - default:
            min: 0.5
            max: 1.0

    illumination_uniformity_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/illumination_uniformity_threshold'
        - description: Illumination uniformity check | not available for warped images.

    illumination_uniformity_check_required:
      allOf:
        - $ref: '#/components/schemas/illumination_uniformity_check'
        - required:
            - estimate
            - threshold

    dynamic_range_threshold:
      allOf:
        - $ref: '#/components/schemas/base_float_threshold'
        - properties:
            min:
              allOf:
                - minimum: 0.0
                - maximum: 1.0
                - description: Inclusive lower bound of the allowed range.
                - $ref: '#/components/schemas/base_float_min_threshold'
            max:
              allOf:
                - minimum: 0.0
                - maximum: 1.0
                - description: Inclusive lower bound of the allowed range.
                - $ref: '#/components/schemas/base_float_max_threshold'
        - default:
            min: 0.5
            max: 1.0

    dynamic_range_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/dynamic_range_threshold'
        - description: Dynamic range of facial skin tone (eliminate extremely light or dark skin tone) | not available for warped images.

    dynamic_range_check_required:
      allOf:
        - $ref: '#/components/schemas/dynamic_range_check'
        - required:
            - estimate
            - threshold

    smile:
      type: string
      enum: ["none", "smile_lips", "smile_teeth"]

    smile_threshold:
      type: array
      items:
        $ref: '#/components/schemas/smile'
      description: List of successful values.
      minItems: 1

    smile_properties_check:
      type: object
      description: Smile_properties check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: array
          items:
            $ref: '#/components/schemas/smile'
          description: List of successful values.
          minItems: 1
          default: ["none"]

    smile_properties_check_required:
      allOf:
        - $ref: '#/components/schemas/smile_properties_check'
        - required:
            - estimate
            - threshold

    smile_properties:
      type: object
      properties:
        name:
          type: string
          enum: ["smile_properties"]
          description: Unique estimation name.
        object_value:
          allOf:
            - $ref: '#/components/schemas/smile'
            - nullable: true
              description: Smile_properties estimated value.
        threshold_value:
          $ref: '#/components/schemas/smile_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: Smile_properties check.

    headwear:
      type: string
      description: |
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      enum: ["none", "baseball_cap", "beanie", "peaked_cap", "shawl", "hat_with_earflaps", "helmet", "hood", "hat", "other"]

    headwear_threshold:
      type: array
      items:
        $ref: '#/components/schemas/headwear'
      description: List of values to consider successful.
      minItems: 1

    headwear_type_check:
      type: object
      description: Headwear_type check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: array
          items:
            $ref: '#/components/schemas/headwear'
          description: List of values to consider successful.
          minItems: 1
          default: ["none"]

    headwear_type_check_required:
      allOf:
        - $ref: '#/components/schemas/headwear_type_check'
        - required:
            - estimate
            - threshold

    headwear_type:
      description: Headwear_type check.
      type: object
      properties:
        name:
          type: string
          enum: ["headwear_type"]
          description: Unique estimation name.
        object_value:
          allOf:
            - $ref: '#/components/schemas/headwear'
            - nullable: true
              description: |
                Estimated value for headwear_type.
                
                > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
                to one element from enum.
        threshold_value:
          $ref: '#/components/schemas/headwear_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]

    bool_threshold:
      type: integer
      enum: [ 0, 1 ]
      description: Value to consider successful.

    radial_distortion_check:
      type: object
      description: Radial_distortion check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: Value to consider successful.

    radial_distortion_check_required:
      allOf:
        - $ref: '#/components/schemas/radial_distortion_check'
        - required:
            - estimate
            - threshold

    radial_distortion:
      description: Radial_distortion check.
      type: object
      properties:
        name:
          type: string
          enum: ["radial_distortion"]
          description: Unique estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - the detection has a radial distortion, 0 - there is no radial distortion.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]

    red_eyes_check:
      type: object
      description: Red_eyes check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: Value to consider successful.

    red_eyes_check_required:
      allOf:
        - $ref: '#/components/schemas/red_eyes_check'
        - required:
            - estimate
            - threshold

    red_eyes:
      type: object
      description: Red eyes check.
      properties:
        name:
          type: string
          enum: ["red_eyes"]
          description: Unique estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - the detection has a red-eye effect, 0 - there is no red-eye effect.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]

    natural_light_check:
      type: object
      description: Natural_light check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 1
          description: Value to consider successful.

    natural_light_check_required:
      allOf:
        - $ref: '#/components/schemas/natural_light_check'
        - required:
            - estimate
            - threshold

    natural_light:
      type: object
      properties:
        name:
          type: string
          enum: ["natural_light"]
          description: Unique estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - detected face has a natural light, 0 - face lighting is not natural.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: Natural_light estimation.

    eyebrow:
      type: string
      enum: ["squinting", "frowning", "raised", "neutral"]

    shoulders_position:
      type: string
      enum: ["non-parallel", "parallel", "hidden"]

    eyebrows_threshold:
      type: array
      items:
        $ref: '#/components/schemas/eyebrow'
      description: List of values to consider successful.
      minItems: 1

    eyebrows_state_check:
      type: object
      description: Eyebrows type check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: array
          items:
            $ref: '#/components/schemas/eyebrow'
          description: List of values to consider successful.
          minItems: 1
          default: ["neutral"]

    eyebrows_state_check_required:
      allOf:
        - $ref: '#/components/schemas/eyebrows_state_check'
        - required:
            - estimate
            - threshold

    shoulders_position_threshold:
      type: array
      items:
        $ref: '#/components/schemas/shoulders_position'
      description: List of values to consider successful.
      minItems: 1

    shoulders_position_check:
      type: object
      description: Soulders position status check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: array
          items:
            $ref: '#/components/schemas/shoulders_position'
          description: List of values to consider successful.
          minItems: 1
          default: ["parallel"]

    shoulders_position_check_required:
      allOf:
        - $ref: '#/components/schemas/shoulders_position_check'
        - required:
            - estimate
            - threshold

    face_occlusion_check:
      type: object
      description: face_occlusion_check check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: |
            Value to consider successful.  1 - detected face should be overlapped, 0 - face should not be overlapped.

    face_occlusion_check_required:
      allOf:
        - $ref: '#/components/schemas/face_occlusion_check'
        - required:
            - estimate
            - threshold

    lower_face_occlusion_check:
      type: object
      description: lower_face_occlusion_check check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: |
            Value to consider successful.  1 - detected face should be overlapped, 0 - face should not be overlapped.

    lower_face_occlusion_check_required:
      allOf:
        - $ref: '#/components/schemas/lower_face_occlusion_check'
        - required:
            - estimate
            - threshold

    forehead_occlusion_check:
      type: object
      description: forehead_occlusion_check check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: |
            Value to consider successful.  1 - detected face should be overlapped, 0 - face should not be overlapped.

    forehead_occlusion_check_required:
      allOf:
        - $ref: '#/components/schemas/forehead_occlusion_check'
        - required:
            - estimate
            - threshold

    nose_occlusion_check:
      type: object
      description: nose_occlusion_check check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: integer
          enum: [ 0, 1 ]
          default: 0
          description: |
            Value to consider successful.  1 - detected face should be overlapped, 0 - face should not be overlapped.

    nose_occlusion_check_required:
      allOf:
        - $ref: '#/components/schemas/nose_occlusion_check'
        - required:
            - estimate
            - threshold

    eyebrows_state:
      description: Eyebrows state check.
      type: object
      properties:
        name:
          type: string
          enum: ["eyebrows_state"]
          description: Unique estimation name.
        object_value:
          allOf:
            - $ref: '#/components/schemas/eyebrow'
            - nullable: true
              description: Eyebrows_state estimated value.
        threshold_value:
          $ref: '#/components/schemas/eyebrows_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]

    shoulders_position_status:
      title: shoulders_position
      description: Shoulders position status check.
      type: object
      properties:
        name:
          type: string
          enum: ["shoulders_position"]
          description: Unique estimation name.
        object_value:
          allOf:
            - $ref: '#/components/schemas/shoulders_position'
            - nullable: true
              description: Eyebrows_state estimated value.
        threshold_value:
          $ref: '#/components/schemas/shoulders_position_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]

    face_occlusion_face_quality:
      type: object
      properties:
        name:
          type: string
          enum: [ "face_occlusion" ]
          description: Unique estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - detected face has an overlap, 0 - face is not overlapped.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: face_occlusion estimation.

    lower_face_occlusion_face_quality:
      type: object
      properties:
        name:
          type: string
          enum: [ "lower_face_occlusion" ]
          description: estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - detected face has an overlap on lower face, 0 - lower face is not overlapped.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: lower_face_occlusion estimation.

    forehead_occlusion_face_quality:
      type: object
      properties:
        name:
          type: string
          enum: [ "forehead_occlusion" ]
          description: estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - forehead is overlapped by something, 0 - forehead is not overlapped.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: forehead_occlusion estimation.

    nose_occlusion_face_quality:
      type: object
      properties:
        name:
          type: string
          enum: [ "nose_occlusion" ]
          description: estimation name.
        object_value:
          nullable: true
          type: integer
          enum: [ 0, 1 ]
          description: Estimated value, 1 - nose is overlapped by something, 0 - nose is not overlapped.
        threshold_value:
          $ref: '#/components/schemas/bool_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: nose_occlusion estimation.

    face_color:
      type: string
      enum: ["color", "grayscale", "infrared"]

    face_color_type_threshold:
      type: array
      items:
        $ref: '#/components/schemas/face_color'
      description: List of values to consider successful.
      minItems: 1

    face_color_type_check:
      type: object
      description: Face color type check configuration.
      properties:
        estimate:
          $ref: '#/components/schemas/estimate_flag'
        threshold:
          type: array
          items:
            $ref: '#/components/schemas/face_color'
          description: List of values to consider successful.
          minItems: 1
          default: ["color"]

    face_color_type_check_required:
      allOf:
        - $ref: '#/components/schemas/face_color_type_check'
        - required:
            - estimate
            - threshold

    face_color_type:
      type: object
      description: Face color type check.
      properties:
        name:
          type: string
          enum: ["face_color_type"]
          description: Unique estimation name.
        object_value:
          allOf:
            - $ref: '#/components/schemas/face_color'
            - nullable: true
              description: Face_color_type estimated value.
        threshold_value:
          $ref: '#/components/schemas/face_color_type_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]

    background_lightness_threshold:
      allOf:
        - $ref: '#/components/schemas/check_threshold_float_0_1'
        - default:
            min: 0.2
            max: 1.0
        - description: Background uniformity threshold, 1 - background is light, 0 - background is dark

    background_lightness_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/background_lightness_threshold'
        - description: Face detection background lightness check | not available for warped images.

    background_lightness_check_required:
      allOf:
        - $ref: '#/components/schemas/background_lightness_check'
        - required:
            - estimate
            - threshold

    background_lightness:
      allOf:
      - $ref: '#/components/schemas/face_check_element_score'
      - properties:
          name:
            enum: [background_lightness]
      - title: background_lightness
      - description: Face detection background lightness check.

    background_uniformity_check:
      allOf:
        - $ref: '#/components/schemas/check_base'
        - properties:
            threshold:
              $ref: '#/components/schemas/background_lightness_threshold'
        - description: Face detection background uniformity check | not available for warped images.

    background_uniformity:
      allOf:
      - $ref: '#/components/schemas/face_check_element_score'
      - properties:
          name:
            enum: [background_uniformity]
      - title: background_uniformity
        description: Face detection background uniformity check.

    background_uniformity_check_required:
      allOf:
        - $ref: '#/components/schemas/background_uniformity_check'
        - required:
            - estimate
            - threshold

    face_quality_checks:
      type: object
      description: Face quality checks and filters.
      properties:
        image_format:
          $ref: '#/components/schemas/image_format_check'
        illumination_quality:
          $ref: '#/components/schemas/illumination_quality_check'
        specularity_quality:
          $ref: '#/components/schemas/specularity_quality_check'
        blurriness_quality:
          $ref: '#/components/schemas/blurriness_quality_check'
        dark_quality:
          $ref: '#/components/schemas/dark_quality_check'
        light_quality:
          $ref: '#/components/schemas/light_quality_check'
        head_yaw:
          $ref: '#/components/schemas/head_yaw_check'
        head_pitch:
          $ref: '#/components/schemas/head_pitch_check'
        head_roll:
          $ref: '#/components/schemas/head_roll_check'
        gaze_yaw:
          $ref: '#/components/schemas/gaze_yaw_check'
        gaze_pitch:
          $ref: '#/components/schemas/gaze_pitch_check'
        mouth_smiling:
          $ref: '#/components/schemas/mouth_smiling_check'
        mouth_occluded:
          $ref: '#/components/schemas/mouth_occluded_check'
        mouth_open:
          $ref: '#/components/schemas/mouth_open_check'
        glasses:
          $ref: '#/components/schemas/glasses_check'
        left_eye:
          $ref: '#/components/schemas/left_eye_check'
        right_eye:
          $ref: '#/components/schemas/right_eye_check'
        head_horizontal_center:
          $ref: '#/components/schemas/head_horizontal_center_check'
        head_vertical_center:
          $ref: '#/components/schemas/head_vertical_center_check'
        head_width:
          $ref: '#/components/schemas/head_width_check'
        head_height:
          $ref: '#/components/schemas/head_height_check'
        eye_distance:
          $ref: '#/components/schemas/eye_distance_check'
        image_width:
          $ref: '#/components/schemas/image_width_check'
        image_height:
          $ref: '#/components/schemas/image_height_check'
        aspect_ratio:
          $ref: '#/components/schemas/aspect_ratio_check'
        face_width:
          $ref: '#/components/schemas/face_width_check'
        face_height:
          $ref: '#/components/schemas/face_height_check'
        indent_left:
          $ref: '#/components/schemas/indent_left_check'
        indent_right:
          $ref: '#/components/schemas/indent_right_check'
        indent_upper:
          $ref: '#/components/schemas/indent_upper_check'
        indent_lower:
          $ref: '#/components/schemas/indent_lower_check'
        image_size:
          $ref: '#/components/schemas/image_size_check'
        eyebrows_state:
          $ref: '#/components/schemas/eyebrows_state_check'
        headwear_type:
          $ref: '#/components/schemas/headwear_type_check'
        smile_properties:
          $ref: '#/components/schemas/smile_properties_check'
        face_color_type:
          $ref: '#/components/schemas/face_color_type_check'
        natural_light:
          $ref: '#/components/schemas/natural_light_check'
        red_eyes:
          $ref: '#/components/schemas/red_eyes_check'
        radial_distortion:
          $ref: '#/components/schemas/radial_distortion_check'
        illumination_uniformity:
          $ref: '#/components/schemas/illumination_uniformity_check'
        background_uniformity:
          $ref: '#/components/schemas/background_uniformity_check'
        background_lightness:
          $ref: '#/components/schemas/background_lightness_check'
        dynamic_range:
          $ref: '#/components/schemas/dynamic_range_check'
        shoulders_position:
          $ref: '#/components/schemas/shoulders_position_check'
        face_occlusion:
          $ref: '#/components/schemas/face_occlusion_check'
        lower_face_occlusion:
          $ref: '#/components/schemas/lower_face_occlusion_check'
        forehead_occlusion:
          $ref: '#/components/schemas/forehead_occlusion_check'
        nose_occlusion:
          $ref: '#/components/schemas/nose_occlusion_check'

    face_quality_checks_required:
      type: object
      description: Face quality checks and filters.
      properties:
        image_format:
          $ref: '#/components/schemas/image_format_check_required'
        illumination_quality:
          $ref: '#/components/schemas/illumination_quality_check_required'
        specularity_quality:
          $ref: '#/components/schemas/specularity_quality_check_required'
        blurriness_quality:
          $ref: '#/components/schemas/blurriness_quality_check_required'
        dark_quality:
          $ref: '#/components/schemas/dark_quality_check_required'
        light_quality:
          $ref: '#/components/schemas/light_quality_check_required'
        head_yaw:
          $ref: '#/components/schemas/head_yaw_check_required'
        head_pitch:
          $ref: '#/components/schemas/head_pitch_check_required'
        head_roll:
          $ref: '#/components/schemas/head_roll_check_required'
        gaze_yaw:
          $ref: '#/components/schemas/gaze_yaw_check_required'
        gaze_pitch:
          $ref: '#/components/schemas/gaze_pitch_check_required'
        mouth_smiling:
          $ref: '#/components/schemas/mouth_smiling_check_required'
        mouth_occluded:
          $ref: '#/components/schemas/mouth_occluded_check_required'
        mouth_open:
          $ref: '#/components/schemas/mouth_open_check_required'
        glasses:
          $ref: '#/components/schemas/glasses_check_required'
        left_eye:
          $ref: '#/components/schemas/left_eye_check_required'
        right_eye:
          $ref: '#/components/schemas/right_eye_check_required'
        head_horizontal_center:
          $ref: '#/components/schemas/head_horizontal_center_check_required'
        head_vertical_center:
          $ref: '#/components/schemas/head_vertical_center_check_required'
        head_width:
          $ref: '#/components/schemas/head_width_check_required'
        head_height:
          $ref: '#/components/schemas/head_height_check_required'
        eye_distance:
          $ref: '#/components/schemas/eye_distance_check_required'
        image_width:
          $ref: '#/components/schemas/image_width_check_required'
        image_height:
          $ref: '#/components/schemas/image_height_check_required'
        aspect_ratio:
          $ref: '#/components/schemas/aspect_ratio_check_required'
        face_width:
          $ref: '#/components/schemas/face_width_check_required'
        face_height:
          $ref: '#/components/schemas/face_height_check_required'
        indent_left:
          $ref: '#/components/schemas/indent_left_check_required'
        indent_right:
          $ref: '#/components/schemas/indent_right_check_required'
        indent_upper:
          $ref: '#/components/schemas/indent_upper_check_required'
        indent_lower:
          $ref: '#/components/schemas/indent_lower_check_required'
        image_size:
          $ref: '#/components/schemas/image_size_check_required'
        eyebrows_state:
          $ref: '#/components/schemas/eyebrows_state_check_required'
        headwear_type:
          $ref: '#/components/schemas/headwear_type_check_required'
        smile_properties:
          $ref: '#/components/schemas/smile_properties_check_required'
        face_color_type:
          $ref: '#/components/schemas/face_color_type_check_required'
        natural_light:
          $ref: '#/components/schemas/natural_light_check_required'
        red_eyes:
          $ref: '#/components/schemas/red_eyes_check_required'
        radial_distortion:
          $ref: '#/components/schemas/radial_distortion_check_required'
        illumination_uniformity:
          $ref: '#/components/schemas/illumination_uniformity_check_required'
        background_uniformity:
          $ref: '#/components/schemas/background_uniformity_check_required'
        background_lightness:
          $ref: '#/components/schemas/background_lightness_check_required'
        dynamic_range:
          $ref: '#/components/schemas/dynamic_range_check_required'
        shoulders_position:
          $ref: '#/components/schemas/shoulders_position_check_required'
        face_occlusion:
          $ref: '#/components/schemas/face_occlusion_check_required'
        lower_face_occlusion:
          $ref: '#/components/schemas/lower_face_occlusion_check_required'
        forehead_occlusion:
          $ref: '#/components/schemas/forehead_occlusion_check_required'
        nose_occlusion:
          $ref: '#/components/schemas/nose_occlusion_check_required'
      required: [image_format, illumination_quality, specularity_quality, blurriness_quality, dark_quality,
                 light_quality, head_yaw, head_pitch, head_roll, gaze_yaw, gaze_pitch, mouth_smiling, mouth_occluded,
                 mouth_open, glasses, left_eye, right_eye, head_horizontal_center, head_vertical_center, head_width,
                 head_height, eye_distance, image_width, image_height, aspect_ratio, face_width, face_height,
                 eyebrows_state, headwear_type, smile_properties, face_color_type, natural_light, red_eyes, radial_distortion,
                 indent_left, indent_right, indent_lower, indent_upper, image_size, illumination_uniformity, dynamic_range,
                 background_lightness, background_uniformity, shoulders_position, face_occlusion, lower_face_occlusion,
                 forehead_occlusion, nose_occlusion]

    face_quality:
      type: object
      description: |
        Face quality estimations checks.

        It enables you to perform various face quality checks by manually specifying thresholds.

        ⚠ **ISO licensing feature is required to be enabled to perform face quality estimation.**
      properties:
        estimate:
          type: integer
          enum: [0, 1]
          default: 0
          description: Whether to estimate face quality.
        filter:
          type: integer
          enum: [0, 1]
          default: 0

          description: |
            Whether to enable face quality filtering.

            If one of the `face_quality` checks for the detection fails, then the results and the reason for filtering will be returned. No further policies will be performed for this detection.
        checks:
          $ref: '#/components/schemas/face_quality_checks'

    estimate_basic_attributes:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01_def0'
        - description: Whether to estimate basic body attributes (apparent_gender, apparent_age) from the image.

    estimate_upper_body:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01_def0'
        - description: |
            Whether to estimate upper body attributes (headwear_state, upper_clothing_color, sleeve_length) from the image.

    estimate_lower_body:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01_def0'
        - description: |
            Whether to estimate lower body attributes (shoes_apparent_color, lower_garment_color) from the image.

    estimate_accessories:
      allOf:
        - default: 0
        - $ref: '#/components/schemas/int01_def0'
        - description: Whether to estimate basic accessories attributes (backpack_state) from the image.

    detect_policy_body_attributes:
      type: object
      description: body attributes estimation configuration
      properties:
        estimate_basic_attributes:
          $ref: "#/components/schemas/estimate_basic_attributes"
        estimate_upper_body:
          $ref: "#/components/schemas/estimate_upper_body"
        estimate_lower_body:
          $ref: "#/components/schemas/estimate_lower_body"
        estimate_accessories:
          $ref: "#/components/schemas/estimate_accessories"

    detect_policy_body_attributes_required:
      allOf:
        - $ref: "#/components/schemas/detect_policy_body_attributes"
      required:
        - estimate_basic_attributes
        - estimate_upper_body
        - estimate_lower_body
        - estimate_accessories

    detect_policy:
      type: object
      properties:
        estimate_people_count:
          $ref: '#/components/schemas/estimate_people_count'

        detect_face:
          $ref: '#/components/schemas/detect_face'

        detect_body:
          $ref: '#/components/schemas/detect_body'

        multiface_policy:
          $ref: '#/components/schemas/multiface_policy'

        estimate_head_pose:
          $ref: '#/components/schemas/estimate_head_pose'

        estimate_emotions:
          $ref: '#/components/schemas/estimate_emotions'

        estimate_mask:
          $ref: '#/components/schemas/estimate_mask'

        estimate_quality:
          $ref: '#/components/schemas/estimate_quality'

        estimate_gaze:
          $ref: '#/components/schemas/estimate_gaze'

        estimate_glasses:
          $ref: '#/components/schemas/estimate_glasses'

        estimate_eyes_attributes:
          $ref: '#/components/schemas/estimate_eyes_attributes'

        estimate_mouth_attributes:
          $ref: '#/components/schemas/estimate_mouth_attributes'

        detect_landmarks68:
          $ref: '#/components/schemas/detect_landmarks68'

        extract_exif:
          $ref: '#/components/schemas/extract_exif'

        yaw_threshold:
          allOf:
            - $ref: '#/components/schemas/yaw_threshold'
            - nullable: true

        roll_threshold:
          allOf:
            - $ref: '#/components/schemas/roll_threshold'
            - nullable: true

        pitch_threshold:
          allOf:
            - $ref: '#/components/schemas/pitch_threshold'
            - nullable: true

        mask_states:
          allOf:
            - $ref: '#/components/schemas/mask_states'
            - nullable: true

        estimate_face_occlusion:
          $ref: '#/components/schemas/estimate_face_occlusion'

        face_occlusion_states:
          allOf:
            - $ref: '#/components/schemas/face_occlusion_states'
            - nullable: true

        estimate_liveness:
          $ref: '#/components/schemas/estimate_liveness'

        liveness_states:
          allOf:
            - $ref: '#/components/schemas/liveness_states'
            - nullable: true

        estimate_deepfake:
          $ref: '#/components/schemas/estimate_deepfake'

        deepfake_states:
          allOf:
            - $ref: '#/components/schemas/deepfake_states'
            - nullable: true

        face_quality:
          $ref: '#/components/schemas/face_quality'

        body_attributes:
          $ref: '#/components/schemas/detect_policy_body_attributes'

      description:  |
        Policy determinates parameters for face and/or body detection.

        > **NOTE** If *`detect_face`* parameter is set to 0, all face detection targets & filters
        (i.e. *`estimate_head_pose`*, *`estimate_emotions`*, *`estimate_quality`*, *`estimate_gaze`*, *`estimate_eyes_attributes`*,
        *`estimate_mouth_attributes`*, *`detect_landmarks68`*, *`yaw_threshold`*, *`roll_threshold`*, *`pitch_threshold`*, *`mask_states`*,
        *`estimate_liveness`*, *`liveness_states`*, *`estimate_deepfake`*, *`deepfake_states`*, *`face_quality`*,
        *`estimate_face_occlusion`*, *`face_occlusion_states`*)
        will be ignored.

        > **NOTE** If *`detect_body`* parameter is set to 0, all body detection targets (*`detect_policy_body_attributes`*)
        will be ignored.

    face_quality_required:
      allOf:
        - $ref: '#/components/schemas/face_quality'
        - properties:
            checks:
              $ref: '#/components/schemas/face_quality_checks_required'
        - required:
          - estimate
          - filter
          - checks

    detect_policy_required:
      allOf:
        - $ref: '#/components/schemas/detect_policy'
        - properties:
            estimate_people_count:
              required: [ estimate ]
            face_quality:
              $ref: '#/components/schemas/face_quality_required'
            body_attributes:
              $ref: '#/components/schemas/detect_policy_body_attributes_required'
        - required:
          - estimate_people_count
          - detect_face
          - detect_body
          - multiface_policy
          - estimate_head_pose
          - estimate_emotions
          - estimate_mask
          - estimate_quality
          - estimate_gaze
          - estimate_glasses
          - estimate_eyes_attributes
          - estimate_mouth_attributes
          - detect_landmarks68
          - extract_exif
          - yaw_threshold
          - pitch_threshold
          - roll_threshold
          - mask_states
          - estimate_liveness
          - liveness_states
          - estimate_deepfake
          - deepfake_states
          - face_quality
          - body_attributes
          - estimate_face_occlusion
          - face_occlusion_states

    extract_policy:
      type: object
      properties:
        extract_basic_attributes:
          $ref: '#/components/schemas/extract_basic_attributes'

        extract_face_descriptor:
          allOf:
          - $ref: '#/components/schemas/extract_descriptor'
          - default: 1

        fd_score_threshold:
          $ref: '#/components/schemas/score_threshold'

        extract_body_descriptor:
          $ref: '#/components/schemas/extract_body_descriptor'
      description: Policy determinates parameters for attributes extraction.

    extract_policy_required:
      allOf:
        - $ref: '#/components/schemas/extract_policy'
        - required: [extract_basic_attributes, extract_face_descriptor, fd_score_threshold, extract_body_descriptor]

    gender_filter:
      type: integer
      enum: [0, 1]
      description: Gender. 1 - male, 0 - female.
      example: 1

    age_lt_filter:
      allOf:
        - description: Lower excluded bound for reference age.
        - example: 30
        - $ref: '#/components/schemas/age'

    age_gte_filter:
      allOf:
        - description: Upper included bound for reference age.
        - example: 30
        - $ref: '#/components/schemas/age'

    meta_filter:
      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 }

    ethnicities_enum:
      type: array
      items:
        type: integer
        enum: [1, 2, 3, 4]
      minItems: 1
      description: |
        Reference ethnicity.

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

    emotions_candidate_filter:
      description: |
        Predominant emotions filter. Each event from the matching result will contain one of given emotions.

        | emotions    | value |
        |-----------------|------|
        | anger           | 1    |
        | disgust         | 2    |
        | fear            | 3    |
        | happiness       | 4    |
        | neutral         | 5    |
        | sadness         | 6    |
        | surprise        | 7    |
        | not estimated   | null |

      type: array
      minItems: 1
      items:
        type: integer
        nullable: true
        enum: [ 1, 2, 3, 4, 5, 6, 7, null ]

    masks_candidate_filter:
      description: |
        Predominant masks filter. Each event from the matching result will contain one of given mask states.

        | masks      | value |
        |----------------|------|
        | missing        | 1    |
        | medical_mask   | 2    |
        | occluded       | 3    |
        | not estimated  | null |

      type: array
      minItems: 1
      items:
        type: integer
        nullable: true
        enum: [ 1, 2, 3, null ]

    label:
      type: string
      description: Label for matching candidates.
      example: "good guys"
      maxLength: 36

    match_filter:
      type: object
      properties:
        label:
          allOf:
          - $ref: '#/components/schemas/label'
          description: Label for matching candidates | must be equal to one of the matching policy labels.
        similarity__lte:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: Upper included bound for best match by the list.
        similarity__gte:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: Lower included bound for best match by the list.
      required: [label]

    match_origin_faces:
      type: string
      enum: ["faces"]
      description: Resource candidates type. Faces or events.

    match_origin_events:
      type: string
      enum: ["events"]
      description: Resource candidates type. Faces or events.

    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.

    face_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: Face ID upper excluded boundary.

    external_ids:
      type: array
      items:
        $ref: '#/components/schemas/filter_external_id'
      description: List of face external IDs.
      minItems: 1
      maxItems: 1000

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

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

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

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

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

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

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

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

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

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

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

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

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

    candidate_face_filters_without_time_filters:
      type: object
      description: Candidate face filters.
      properties:
        origin:
          $ref: '#/components/schemas/match_origin_faces'
        face_ids:
          $ref: '#/components/schemas/face_ids'
        account_id:
          allOf:
          - $ref: '#/components/schemas/account_id'
          description: |
            Account ID.
            > **WARNING** Handler's *account id* will be automaically use for matching filters if handler is dynamic.
        external_ids:
          $ref: '#/components/schemas/external_ids'
        user_data:
          $ref: '#/components/schemas/user_data_filter'
        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 ]
      minProperties: 1

    tags:
      description: List of tags.
      type: array
      items:
        type: string
        maxLength: 36
      example: ['tag1', 'tag2']

    areas:
      description: List of areas. Each event from result will contain one of the given areas in location.
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      example: ['area1', 'area2', null]
      minItems: 1
      maxItems: 1000

    cities:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      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:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      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:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      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:
      type: array
      items:
        $ref: '#/components/schemas/location_str'
      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

    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
      maxLength: 128
      description: Some additional information that user provided with event.
      example: "3rd Avenue"

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

    sources:
      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_ids:
      type: array
      items:
        $ref: '#/components/schemas/stream_id'
      description: List of stream ids.
      minItems: 1
      maxItems: 1000


    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.

    event_id__lt:
      allOf:
        - $ref: '#/components/schemas/uuid'
        - description: Event ID upper excluded boundary.

    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/uuid'
      description: List of top 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.
      minItems: 1
      maxItems: 1000

    similarity:
      $ref: '#/components/schemas/number01'

    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.

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

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

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

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

    handler_ids:
      type: array
      items:
        $ref: '#/components/schemas/handler_id'
      description: List of handler IDs.
      minItems: 1
      maxItems: 1000

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

    ethnic_groups_candidate_filter:
      type: array
      minItems: 1
      items:
        type: integer
        nullable: true
        enum: [ 1, 2, 3, 4, null ]
      description: |
        Ethnic group filter. Each event from matching result will contain one of the given ethnic groups.

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

    geo_position_bbox:
      type: object
      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]

    apparent_gender:
      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:
      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 ]

    sleeve_lengths:
      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_colors:
      type: array
      minItems: 1
      items:
        type: string
        enum: [ black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored, undefined, null ]
      description: |
        Clothing color filter. Each event from result will contain at least one of the given clothing colors.
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      example: [ black, white ]

    backpack_states:
      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 ]

    lower_garment_types:
      type: array
      minItems: 1
      items:
          type: string
          enum: [ undefined, trousers, shorts, skirt, null]
      description: |
        Lower garment type filter.
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      example: [ 'shorts',  'skirt' ]

    shoes_apparent_colors:
      type: array
      minItems: 1
      items:
        type: string
        enum: [ undefined, black, white, other, null ]
        description: Shoes apparent color.
        nullable: true
      description: |
        Shoes apparent color filter.
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      example: [ 'white' ]

    headwear_apparent_colors:
      type: array
      minItems: 1
      items:
        type: string
        enum: [ undefined, black, white, other, null]
        description: Headwear apparent color.
      description: |
        Headwear apparent color filter.
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      example: [ 'black' ]

    candidate_event_filters_without_time_filters:
      type: object
      description: Candidate event filters.
      properties:
        origin:
          $ref: '#/components/schemas/match_origin_events'
        event_ids:
          $ref: '#/components/schemas/event_ids'
        account_id:
          allOf:
          - $ref: '#/components/schemas/account_id'
          description: |
            Account ID.
            > **WARNING** Handler's *account id* will be automaically use for matching filters if handler is dynamic.
        event_id__gte:
          $ref: '#/components/schemas/event_id__gte'
        event_id__lt:
          $ref: '#/components/schemas/event_id__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:
          $ref: '#/components/schemas/gender'
        emotions:
          $ref: '#/components/schemas/emotions_candidate_filter'
        liveness:
          $ref: '#/components/schemas/liveness_candidate_filter'
        deepfake:
          $ref: '#/components/schemas/deepfake_candidate_filter'
        masks:
          $ref: '#/components/schemas/masks_candidate_filter'
        ethnic_groups:
          $ref: '#/components/schemas/ethnic_groups_candidate_filter'
        face_ids:
          $ref: '#/components/schemas/face_ids'
        user_data:
          $ref: '#/components/schemas/user_data_filter'
        sources:
          $ref: '#/components/schemas/sources'
        stream_ids:
          $ref: '#/components/schemas/stream_ids'
        tags:
          $ref: '#/components/schemas/tags'
        cities:
          $ref: '#/components/schemas/cities'
        areas:
          $ref: '#/components/schemas/areas'
        districts:
          $ref: '#/components/schemas/districts'
        streets:
          $ref: '#/components/schemas/streets'
        house_numbers:
          $ref: '#/components/schemas/house_numbers'
        geo_position:
          $ref: '#/components/schemas/geo_position_bbox'
        track_ids:
          $ref: '#/components/schemas/track_ids'
        apparent_gender:
          $ref: '#/components/schemas/apparent_gender'
        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'
        sleeve_lengths:
          $ref: '#/components/schemas/sleeve_lengths'
        upper_clothing_colors:
          $ref: '#/components/schemas/clothing_colors'
        lower_garment_colors:
          $ref: '#/components/schemas/clothing_colors'
        backpack_states:
          $ref: '#/components/schemas/backpack_states'
        lower_garment_types:
          $ref: '#/components/schemas/lower_garment_types'
        shoes_apparent_colors:
          $ref: '#/components/schemas/shoes_apparent_colors'
        headwear_apparent_colors:
          $ref: '#/components/schemas/headwear_apparent_colors'
      required: [origin]
      minProperties: 1

    matching_threshold:
      allOf:
      - $ref: '#/components/schemas/number01'
      description: Matching similarity threshold.

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

    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"

    image_origin_base64:
      type: string
      description: |
        Image in base64. The specified image will be used as `image_origin` for created events independently of `image_origin_policy`.
      nullable: false

    image_origin_mimetype:
      type: string
      description: Image origin mimetype. Must be set if image origin is provided as base64 image.
      enum: ["image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
              "image/x-portable-pixmap-base64"]
      nullable: false

    image_origin_not_nullable:
      allOf:
        - $ref: "#/components/schemas/image_origin"
      description: |
        The specified URL will be used as `image_origin` for created events independently of `image_origin_policy`.
      nullable: false

    image_origin_not_nullable_base64_json:
      oneOf:
        - $ref: '#/components/schemas/image_origin_not_nullable'
        - $ref: '#/components/schemas/image_origin_base64'

    image_origin_list_item_json:
      type: object
      properties:
        filename:
          type: string
          description: Image filename. It must be the same as one of 'image' request part filename.
        image_origin:
          oneOf:
            - $ref: '#/components/schemas/image_origin_not_nullable_base64_json'
        mimetype:
          $ref: '#/components/schemas/image_origin_mimetype'
      required: [filename, image_origin]

    event_meta_common:
      type: object
      additionalProperties: true
      description: User defined metadata (json object). Size shouldn't exceed 2MB.
      example:
        key: value

    event_meta_list:
      type: array
      description: Map with image filename and event meta.
      items:
        type: object
        properties:
          filename:
            type: string
            description: Image filename. It must be the same as one of 'image' request part filename.
          meta:
            $ref: '#/components/schemas/event_meta_common'
        required: [ filename, meta ]
      minItems: 1

    event_meta:
      oneOf:
        - $ref: '#/components/schemas/event_meta_common'
        - $ref: '#/components/schemas/event_meta_list'

    face_matching_targets:
      type: array
      items:
        type: string
        enum: ["face_id", "account_id", "event_id", "user_data", "create_time", "external_id", "avatar", "lists"]

    event_matching_targets:
      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", "body_basic_attributes", "upper_body", "lower_body", "accessories", "user_data",
               "location", "mask", "liveness", "deepfake", "track_id", "meta"]

    matching_targets:
      description: |
        List of face/event fields.
        If set, each face/event from result will contain only specified fields, otherwise, faces/events with all fields will be returned.
        If targets do not specified, all targets will return.
      oneOf:
        - $ref: '#/components/schemas/face_matching_targets'
        - $ref: '#/components/schemas/event_matching_targets'

    matching_descriptor:
      description: Candidate descriptor parameters.
      type: object
      properties:
        descriptor_type:
          description: |
            Candidate descriptor type.

            | candidate type | descriptor type supported |
            |----------------|---------------------------|
            | face           | face                      |
            | event          | face / body               |

          type: string
          enum: [ 'face', 'body' ]
          default: face

    handler_match_policy_without_candidates:
      type: array
      items:
        type: object
        properties:
          label:
            allOf:
            - $ref: '#/components/schemas/label'
            default: ""
          filters:
            $ref: '#/components/schemas/emit_events_match_filters'
          descriptor:
            $ref: '#/components/schemas/matching_descriptor'
          limit:
            $ref: '#/components/schemas/matching_limit'
          targets:
            $ref: '#/components/schemas/matching_targets'
          threshold:
            $ref: '#/components/schemas/matching_threshold'
        required: [candidates]
      minItems: 0
      maxItems: 30
      description: |
        Match attributes policy. This policy will be used for each event which descriptor was extracted successfully and which satisfies the filters.

    candidate_face_filters:
      allOf:
      - $ref: '#/components/schemas/candidate_face_filters_without_time_filters'
      - properties:
          create_time__gte:
            description: Create time lower included boundary.
            oneOf:
              - $ref: '#/components/schemas/create_time__gte'
              - $ref: '#/components/schemas/create_time_now__gte'
          create_time__lt:
            description: Create time upper excluded boundary.
            oneOf:
              - $ref: '#/components/schemas/create_time__lt'
              - $ref: '#/components/schemas/create_time_now__lt'

    candidate_event_filters:
      allOf:
      - $ref: '#/components/schemas/candidate_event_filters_without_time_filters'
      - properties:
          create_time__gte:
            description: Create time lower included boundary.
            oneOf:
              - $ref: '#/components/schemas/create_time__gte'
              - $ref: '#/components/schemas/create_time_now__gte'
          create_time__lt:
            description: Create time upper excluded boundary.
            oneOf:
              - $ref: '#/components/schemas/create_time__lt'
              - $ref: '#/components/schemas/create_time_now__lt'
          end_time__gte:
            description: End time lower included boundary.
            oneOf:
              - $ref: '#/components/schemas/end_time__gte'
              - $ref: '#/components/schemas/end_time_now__gte'
          end_time__lt:
            description: End time upper excluded boundary.
            oneOf:
              - $ref: '#/components/schemas/end_time__lt'
              - $ref: '#/components/schemas/end_time_now__lt'
          meta:
            $ref: '#/components/schemas/meta_filter'

    handler_match_policy:
      allOf:
      - $ref: '#/components/schemas/handler_match_policy_without_candidates'
      - items:
          properties:
            candidates:
              description: Matching candidate filters.
              oneOf:
                - $ref: '#/components/schemas/candidate_face_filters'
                - $ref: '#/components/schemas/candidate_event_filters'

    link_to_lists_policy:
      type: array
      items:
        type: object
        properties:
          list_id:
            $ref: '#/components/schemas/list_id'
          filters:
            allOf:
            - $ref: '#/components/schemas/emit_events_full_filters'
            - description: Filters determine whether to link stored face to the list.
        required: [list_id]
      minItems: 0
      maxItems: 30
      description: Set of luna lists with filters for attaching stored faces.

    link_to_lists_policy_required:
      # must be same as link_to_lists_policy
      type: array
      items:
        type: object
        properties:
          list_id:
            $ref: '#/components/schemas/list_id'
          filters:
            allOf:
            - $ref: '#/components/schemas/emit_events_full_filters'
            - description: Filters determine whether to link created face to the list.
        required: [list_id, filters]
      minItems: 0
      maxItems: 30
      description: Set of luna lists for linking of created faces.

    face_storage_policy:
      type: object
      description: Whether to store a face and link it to lists.
      properties:
        store_face:
          allOf:
          - $ref: '#/components/schemas/int01_def0'
          description: Whether to store a face.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store a face. Only the faces corresponding to the specified filters will be stored.
        set_sample_as_avatar:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to set a sample as an avatar for stored faces.
          default: 1
        link_to_lists_policy:
          $ref: '#/components/schemas/link_to_lists_policy'

    face_storage_policy_required:
      # must be same as face_storage_policy
      type: object
      description: Whether to store a face and link it to lists.
      properties:
        store_face:
          allOf:
          - $ref: '#/components/schemas/int01_def0'
          description: Whether to store a face.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store a face. Only the faces corresponding to the specified filters will be stored.
        set_sample_as_avatar:
          allOf:
          - $ref: '#/components/schemas/int01'
          description: Whether to set a sample as an avatar for stored faces.
          default: 1
        link_to_lists_policy:
          $ref: '#/components/schemas/link_to_lists_policy_required'
      required: [store_face, set_sample_as_avatar, filters, link_to_lists_policy]

    int_ttl:
      type: integer
      enum: [-1, 1, 2, 3, 4, 5, 6, 7, 14, 30, 60, 90, 180, 365]
      description: |
        TTL parameter is used to specify the lifetime of objects, measuring in days.
        - `-1` allows to store objects infinitely.
        - If `null` set, parameter will be taken from the parent bucket's config, which means that the object will be retained when the bucket ttl comes.
      example: 7
      default: null
      nullable: true

    face_sample_storage_policy:
      type: object
      description: Face sample storing policy.
      properties:
        store_sample:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: Whether to store a face sample.
          - default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store a face sample or not. Only the samples corresponding to the specified filters will be stored.
        ttl:
          $ref: '#/components/schemas/int_ttl'

    face_sample_storage_policy_required:
      # must be same as face_sample_storage_policy
      allOf:
        - $ref: '#/components/schemas/face_sample_storage_policy'
        - required: [store_sample, filters, ttl]

    body_sample_storage_policy:
      type: object
      description: Human body sample storing policy.
      properties:
        store_sample:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: Whether to store a human body sample.
          - default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store a human body sample or not. Only the samples corresponding to the specified filters will be stored.
        ttl:
          $ref: '#/components/schemas/int_ttl'

    body_sample_storage_policy_required:
      # must be same as face_sample_storage_policy
      allOf:
        - $ref: '#/components/schemas/body_sample_storage_policy'
        - required: [store_sample, filters, ttl]

    image_origin_storage_policy:
      type: object
      description: Image origin policy.
      properties:
        store_image:
          allOf:
          - $ref: '#/components/schemas/int01_def0'
          - description: Whether to store an origin image of the detection.
          - default: 0
        use_external_references:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: |
              Whether to use external reference as image origin url. External references are urls, sample ids and
              saved samples. This setting is needed for origin images duplicate prevention. If an external url is
              to large (more than 256 symbols) service will store the image to image-store.
          - default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store an origin image or not. Only the images corresponding to the specified filters will be stored.
        ttl:
          $ref: '#/components/schemas/int_ttl'

    image_origin_storage_policy_required:
      # must be same as image_origin_storage_policy
      allOf:
        - $ref: '#/components/schemas/image_origin_storage_policy'
        - required: [store_image, filters, ttl]

    attribute_storage_policy:
      type: object
      description: Attribute storing policy.
      properties:
        store_attribute:
          allOf:
          - $ref: '#/components/schemas/int01_def0'
          description: Whether to store an attribute.
          default: 0
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store an attribute or not. Only the attributes corresponding to the specified filters will be stored.
        ttl:
          type: integer
          minimum: 0
          maximum: 86400
          default: 300
          description: Attribute storage duration (sec). Attribute will be removed after this time runs out.

    attribute_storage_policy_required:
      # must be same as attribute_storage_policy
      allOf:
        - $ref: '#/components/schemas/attribute_storage_policy'
        - required: [store_attribute, filters, ttl]

    event_storage_policy:
      type: object
      description: Event storing policy.
      properties:
        store_event:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: Whether to store an event.
          - default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to store an event or not. Only the events corresponding to the specified filters will be stored.
        wait_saving:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: |
              Whether to wait for events saving to the Events service before sending the response. The request will be
              executed faster if this feature is disabled, but it is not guaranteed that the events will be saved to
              the Events database.
          - default: 1

    event_storage_policy_required:
      # must be same as event_storage_policy
      allOf:
        - $ref: '#/components/schemas/event_storage_policy'
        - required: [store_event, filters, wait_saving]

    callback_basic_authorization:
      type: object
      properties:
        type:
          type: string
          description: Authorization type.
          enum: [basic]
        login:
          type: string
          maxLength: 128
          description: Login.
        password:
          type: string
          maxLength: 128
          description: Password.
      required: [ type, login, password]
      description: Callback basic authorization parameters

    http_callback:
      type: object
      properties:
        type:
          type: string
          enum: [http]
        authorization:
          $ref: '#/components/schemas/callback_basic_authorization'
        url:
          type: string
          description: Request url.
          format: uri-reference
        params:
          type: object
          properties:
            timeout:
              type: integer
              default: 60
              description: Callback request timeout.
            content_type:
              type: string
              default: application/json
              enum: [application/json, application/msgpack]
              description: Callback request content type.
            headers:
              type: object
              description: Callback request headers.
              additionalProperties: true
          description: Callback request parameters
        filters:
          allOf:
            - $ref: '#/components/schemas/emit_events_full_filters'
            - description: Filters determine whether to send a callback or not. Only the callbacks corresponding to the specified filters will be sent.
        enable:
          allOf:
            - $ref: '#/components/schemas/int01'
            - description: Whether callback enabled or not
            - default: 1
      required: [ type, url ]

    http_callback_required:
      allOf:
        - $ref: '#/components/schemas/http_callback'
        - required: [type, url, params, filters, enable]
  
    luna_ws_callback:
      type: object
      properties:
        type:
          type: string
          enum: [luna-ws-notification]
        filters:
          allOf:
            - $ref: '#/components/schemas/emit_events_full_filters'
            - description: Filters determine whether to send a callback or not. Only the callbacks corresponding to the specified filters will be sent.
        enable:
          allOf:
            - $ref: '#/components/schemas/int01'
            - description: Whether callback enabled or not
            - default: 1
      required: [ type ]

    luna_ws_callback_required:
      allOf:
        - $ref: '#/components/schemas/luna_ws_callback'
        - required: [type, filters, enable]

    callbacks:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/http_callback'
          - $ref: '#/components/schemas/luna_ws_callback'
        discriminator:
          propertyName: type
          mapping:
            http: '#/components/schemas/http_callback'
            luna-ws-notification: '#/components/schemas/luna_ws_callback'
      description: |
        Callbacks for sending generated events to third party system. Callbacks are executed after all storage policies.
        Events sent using callback have corresponding format with ones from `generate event` resource
        
        ** Sample Output **
        ```
        {
          "events": [
            {
              "aggregate_estimations": {
                "body": {
                  "attributes": {}
                },
                "face": {
                  "attributes": {}
                }
              },
              "body_attributes": null,
              "detections": [...],
              "event_id": ...,
              "external_id": "",
              "face": null,
              "face_attributes": {
                "attribute_id": null,
                "basic_attributes": {...},
                "samples": [...],
                "score": ...,
                "url": null
              },
              "location": {...},
              "matches": [...],
              "meta": {...},
              "source": null,
              "stream_id": null,
              "tags": [...],
              "track_id": null,
              "url": "/6/events/...",
              "user_data": ""
            }
          ]
        }
        ```

    callbacks_required:
      type: array
      items:
        oneOf:
          - $ref: '#/components/schemas/http_callback_required'
          - $ref: '#/components/schemas/luna_ws_callback_required'
        discriminator:
          propertyName: type
          mapping:
            http: '#/components/schemas/http_callback_required'
            luna-ws-notification: '#/components/schemas/luna_ws_callback_required'
      description: Callbacks for sending generated events to third party system.

    notification_sending_policy:
      deprecated: true
      type: object
      description: |
        Notification sending policy

        > **WARNING** Notification policy become deprecated, consider to use `luna-ws-notification` callbacks instead.
      properties:
        send_notification:
          allOf:
          - $ref: '#/components/schemas/int01'
          - description: Whether to send a notification
          - default: 1
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to send a notification or not. Only the notifications corresponding to the specified filters will be sent.


    notification_sending_policy_required:
      # must be same as notification_sending_policy
      allOf:
        - $ref: '#/components/schemas/notification_sending_policy'
        - required: [ send_notification, filters ]

    conditional_tag_policy:
      type: object
      properties:
        tag:
          $ref: '#/components/schemas/tag'
        filters:
          allOf:
          - $ref: '#/components/schemas/emit_events_full_filters'
          - description: Filters determine whether to add the tag to event.
      required: [tag]

    conditional_tags_policy:
      type: array
      items:
        $ref: '#/components/schemas/conditional_tag_policy'
      minItems: 0
      maxItems: 30
      description: Set of event tags for adding to event by conditions.

    conditional_tags_policy_required:
      type: array
      items:
        allOf:
          - $ref: '#/components/schemas/conditional_tag_policy'
          - required: [tag, filters]
      minItems: 0
      maxItems: 30
      description: Set of event tags for adding to event by conditions.

    int_version:
      type: integer
      minimum: 0

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

    base_face:
      type: object
      description: Face object.
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          - description: Event ID associated with the face creation.
          - nullable: true
        user_data:
          $ref: '#/components/schemas/face_user_data'
        external_id:
          $ref: '#/components/schemas/face_external_id'
        avatar:
          $ref: '#/components/schemas/face_avatar'
        lists:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          minItems: 0
          description: List of luna lists, which contain the face.
      example:
        face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
        account_id: d5c0a8c6-5509-4e5b-8a01-e2ab426542d6
        event_id: f9687459-986b-406d-9c1f-0d6289be5256
        user_data: fox1991
        external_id: 2xQ2gprbMUePw1s9gw9fvA==
        avatar: '/6/samples/faces/429b0e78-4616-426a-b57f-02baa72d638d'
        lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']

    input_event_face:
      description: Face structure of input event.
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            url:
              type: string
              description: Face location url.
              format: uri-reference
        - required: []
        - example:
            face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
            event_id: f9687459-986b-406d-9c1f-0d6289be5256
            user_data: fox1991
            external_id: 2xQ2gprbMUePw1s9gw9fvA==
            avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
            lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
            url: "http://127.0.0.1:5030/3/faces/426542d6-5509-4e5b-8a01-e2abd5c0a8c6"

    event_face:
      description: Handler generated face.
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            url:
              type: string
              description: Created face location url.
              format: uri-reference
        - example:
            face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
            event_id: f9687459-986b-406d-9c1f-0d6289be5256
            user_data: fox1991
            external_id: 2xQ2gprbMUePw1s9gw9fvA==
            avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
            lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']
            url: "http://127.0.0.1:5030/3/faces/426542d6-5509-4e5b-8a01-e2abd5c0a8c6"

    face:
      description: Face.
      allOf:
        - $ref: '#/components/schemas/base_face'
        - properties:
            account_id:
              $ref: '#/components/schemas/account_id'
        - example:
            account_id: 12345459-bfbf-406d-9c1f-0d6289aaaaa
            face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
            event_id: f9687459-986b-406d-9c1f-0d6289be5256
            user_data: fox1991
            external_id: 2xQ2gprbMUePw1s9gw9fvA==
            avatar: 'https://st.kp.yandex.net/images/actor_iphone/iphone360_460188.jpg'
            lists: ["429b0e78-4616-426a-b57f-02baa72d638d", '6d037c33-31ec-4d73-b3b3-ec80b09446c2']

    emit_events_match_filters:
      type: object
      description: Filters for matching are based on the results of the extraction.
      properties:
        gender:
          $ref: '#/components/schemas/gender_filter'
        ethnicities:
          $ref: '#/components/schemas/ethnicities_enum'
        age__lt:
          $ref: '#/components/schemas/age_lt_filter'
        age__gte:
          $ref: '#/components/schemas/age_gte_filter'
        liveness:
          $ref: '#/components/schemas/liveness_states'
        deepfake:
          $ref: '#/components/schemas/deepfake_states'

    emit_events_full_filters:
      allOf:
        - $ref: '#/components/schemas/emit_events_match_filters'
        - description: Filters for matching are based on the results of the extraction.
        - properties:
            match:
              type: array
              items:
                $ref: '#/components/schemas/match_filter'
              minItems: 0
              description: List of policies based on match results.
              maxItems: 30

    storage_policy:
      type: object
      description: Objects storage policy.
      properties:
        face_sample_policy:
          $ref: '#/components/schemas/face_sample_storage_policy'
        body_sample_policy:
          $ref: '#/components/schemas/body_sample_storage_policy'
        image_origin_policy:
          $ref: '#/components/schemas/image_origin_storage_policy'
        attribute_policy:
          $ref: '#/components/schemas/attribute_storage_policy'
        face_policy:
          $ref: '#/components/schemas/face_storage_policy'
        event_policy:
          $ref: '#/components/schemas/event_storage_policy'
        notification_policy:
          $ref: '#/components/schemas/notification_sending_policy'
        callbacks:
          $ref: '#/components/schemas/callbacks'

    storage_policy_required:
      # must be same as storage_policy
      type: object
      properties:
        face_sample_policy:
          $ref: '#/components/schemas/face_sample_storage_policy_required'
        body_sample_policy:
          $ref: '#/components/schemas/body_sample_storage_policy_required'
        image_origin_policy:
          $ref: '#/components/schemas/image_origin_storage_policy_required'
        attribute_policy:
          $ref: '#/components/schemas/attribute_storage_policy_required'
        face_policy:
          $ref: '#/components/schemas/face_storage_policy_required'
        event_policy:
          $ref: '#/components/schemas/event_storage_policy_required'
        notification_policy:
          $ref: '#/components/schemas/notification_sending_policy_required'
        callbacks:
          $ref: '#/components/schemas/callbacks_required'
      required: [face_sample_policy, body_sample_policy, image_origin_policy, attribute_policy, face_policy, event_policy, notification_policy, callbacks]

    Policies:
      type: object
      description: Set of rules, that determines input images processing
      properties:
        detect_policy:
          allOf:
          - $ref: '#/components/schemas/detect_policy'
          - description: Face detection policy.
        extract_policy:
          allOf:
          - $ref: '#/components/schemas/extract_policy'
          - description: Extract attributes policy.
        match_policy:
          $ref: '#/components/schemas/handler_match_policy'
        storage_policy:
          $ref: '#/components/schemas/storage_policy'
        conditional_tags_policy:
          $ref: '#/components/schemas/conditional_tags_policy'

    PoliciesWithRequired:
      type: object
      description: Set of rules, which determine input images processing. Empty policies refer to dynamic handler.
      properties:
        detect_policy:
          allOf:
            - $ref: '#/components/schemas/detect_policy_required'
            - type: object
              description: Face detection policy.
        extract_policy:
          allOf:
            - $ref: '#/components/schemas/extract_policy_required'
            - description: Extract attributes policy.
        match_policy:
          $ref: '#/components/schemas/handler_match_policy'
        storage_policy:
          $ref: '#/components/schemas/storage_policy_required'
        conditional_tags_policy:
          $ref: '#/components/schemas/conditional_tags_policy_required'
      required: [detect_policy, extract_policy, match_policy, storage_policy, conditional_tags_policy]

    handlers_validator:
      type: object
      properties:
        policies:
          $ref: '#/components/schemas/Policies'
      required: [policies]

    New_Handler:
      type: object
      properties:
        description:
          type: string
          maxLength: 128
          description: User description.
          example: second avenue
        policies:
          $ref: '#/components/schemas/Policies'
        handler_type:
          $ref: '#/components/schemas/handler_type'
        lambda_id:
          $ref: '#/components/schemas/lambda_id'

    HandlerInResponse:
      type: object
      properties:
        handler_id:
          $ref: '#/components/schemas/handler_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          type: string
          maxLength: 128
          description: User description.
        policies:
          allOf:
          - $ref: '#/components/schemas/PoliciesWithRequired'
          - nullable: true
        create_time:
          type: string
          format: date-time
          readOnly: true
          description: Handler creation time.
        last_update_time:
          type: string
          format: date-time
          readOnly: true
          description: Handler last update time.
        handler_type:
          $ref: '#/components/schemas/handler_type'
        lambda_id:
          $ref: '#/components/schemas/lambda_id'
      required: [handler_id, account_id, description, create_time, last_update_time, policies, handler_type]

    event_detection_samples:
      type: object
      properties:
        filename:
          $ref: '#/components/schemas/filename'
        samples:
          type: object
          description: |
            Body & face related samples that refer to the one person.
            If one of **body** or **face** field is *null*, it means that either the corresponding detection is disabled
            (see *detect_face*, *detect_body* parameters in [handler detect policy](#operation/createHandler)),
            or the detection has been filtered. Both **body** and **face** fields can not be *null* at the same time,
            except for [stream events](#operation/generateStreamEvents)
          properties:
            body:
              allOf:
                - $ref: '#/components/schemas/body_detection_sample'
                - nullable: true
            face:
              allOf:
                - $ref: '#/components/schemas/face_detection_sample'
                - nullable: true
          required: [ body, face ]
        detect_time:
          $ref: "#/components/schemas/detect_time"
        detect_ts:
          $ref: "#/components/schemas/detect_ts"
        image_origin:
          $ref: "#/components/schemas/image_origin"
      required: [filename, samples, detect_time, image_origin, detect_ts]

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

    body_basic_attributes_not_nullable:
      allOf:
      - $ref: "#/components/schemas/body_basic_attributes"
      nullable: false

    expanded_palette:
      description: |
        expanded color palette for clothing
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      type: string
      enum: [ black, blue, green, gray, orange, purple, red, white, yellow, pink, brown, beige, khaki, multicolored, undefined ]

    short_palette:
      description: |
        short color palette
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.
      type: string
      enum: [ black, other, white, undefined ]

    upper_body_attributes_base:
      type: object
      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/short_palette"
              description: |
                Headwear apparent color.
                
                > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
                to one element from enum.
          required: [ state ]
          description: Headwear attributes.
        sleeve:
          type: object
          properties:
            length:
              type: string
              enum: [ short, long, undefined ]
              description: Sleeve length.
          required: [ length ]
          description: Sleeve attributes.
        upper_clothing:
          type: object
          properties:
            colors:
              type: array
              items:
                $ref: "#/components/schemas/expanded_palette"
              description: |
                Upper clothing color set.
                
                > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
                to one element from enum.
          required: [ colors ]
          description: Upper clothing attibutes.
      required: [ headwear, sleeve, upper_clothing ]

    lower_garment_type:
      type: string
      enum: [ skirt, shorts, trousers, undefined ]
      description: |
        lower garment type.
        
        > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
        to one element from enum.

    lower_body_attributes:
      type: object
      description: Lower body attributes.
      nullable: true
      properties:
        shoes:
          type: object
          properties:
            apparent_color:
              allOf:
              - $ref: "#/components/schemas/short_palette"
              description: |
                Shoes apparent color.
                
                > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal
                to one element from enum.
          required: [ apparent_color ]
          description: shoes attributes.
        lower_garment:
          type: object
          properties:
            colors:
              type: array
              items:
                $ref: "#/components/schemas/expanded_palette"
              description: |
                lower garment color set.
                
                > **WARNING** This enum may be to expand. This field must be interpret as arbitrary string which can be equal 
                to one element from enum.
            type:
              $ref: "#/components/schemas/lower_garment_type"
          required: [ colors ]
          description: Lower garment attibutes.
      required: [ lower_garment, shoes]


    estimated_upper_body_attributes:
      allOf:
      - $ref: "#/components/schemas/upper_body_attributes_base"
      - properties:
          headwear:
            required: [ state, apparent_color ]
      nullable: false

    saved_event_upper_body_attributes:
      allOf:
      - $ref: "#/components/schemas/upper_body_attributes_base"
      - properties:
          headwear:
            properties:
              apparent_color:
                nullable: true
            required: [ state, apparent_color ]
      nullable: true

    input_upper_body_attributes:
      - $ref: "#/components/schemas/upper_body_attributes_base"

    lower_body_attributes_not_nullable:
      allOf:
      - $ref: "#/components/schemas/lower_body_attributes"
      nullable: false

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

    body_accessories_not_nullable:
      allOf:
      - $ref: "#/components/schemas/body_accessories"
      nullable: false

    EventAggregateEstimations:
      type: object
      description: Aggregated attributes estimated from samples.
      properties:
        face:
          type: object
          description: Face aggregated estimations.
          properties:
            attributes:
              type: object
              description: Estimated attributes.
              properties:
                liveness:
                  $ref: "#/components/schemas/liveness"
                deepfake:
                  $ref: "#/components/schemas/deepfake"
                emotions:
                  $ref: "#/components/schemas/emotions"
                mask:
                  $ref: "#/components/schemas/masks"
          required: [attributes]
        body:
          type: object
          description: Aggregated body estimations.
          properties:
            attributes:
              type: object
              description: Body extra attributes.
              properties:
                upper_body:
                  $ref: "#/components/schemas/estimated_upper_body_attributes"
                lower_body:
                  $ref: "#/components/schemas/lower_body_attributes_not_nullable"
                basic_attributes:
                  $ref: "#/components/schemas/body_basic_attributes_not_nullable"
                accessories:
                  $ref: "#/components/schemas/body_accessories_not_nullable"
          required: [attributes]
      required: [face, body]

    EventAggregateEstimations_masks_occlusion_not_required:
      type: object
      description: Aggregated attributes estimated from samples.
      properties:
        face:
          type: object
          description: Face aggregated estimations.
          properties:
            attributes:
              type: object
              description: Estimated attributes.
              properties:
                liveness:
                  $ref: "#/components/schemas/liveness"
                deepfake:
                  $ref: "#/components/schemas/deepfake"
                emotions:
                  $ref: "#/components/schemas/emotions"
                mask:
                  $ref: "#/components/schemas/masks_occlusion_not_required"
          required: [attributes]
        body:
          type: object
          description: Aggregated body estimations.
          properties:
            attributes:
              type: object
              description: Body extra attributes.
              properties:
                upper_body:
                  $ref: "#/components/schemas/input_upper_body_attributes"
                lower_body:
                  $ref: "#/components/schemas/lower_body_attributes_not_nullable"
                basic_attributes:
                  $ref: "#/components/schemas/body_basic_attributes_not_nullable"
                accessories:
                  $ref: "#/components/schemas/body_accessories_not_nullable"
          required: [attributes]
      required: [face, body]

    EventFromHandler:
      type: object
      description: Event format from handler.
      properties:
        face_attributes:
          allOf:
          - description: Extracted face attributes from samples.
          - $ref: '#/components/schemas/attribute'
          - nullable: true
        body_attributes:
          allOf:
            - description: Extracted body attributes from samples.
            - $ref: '#/components/schemas/BodyAttribute'
            - nullable: true
        aggregate_estimations:
          $ref: '#/components/schemas/EventAggregateEstimations'
        source:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/source'
        stream_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/stream_id'
        tags:
          $ref: '#/components/schemas/Tags'
        external_id:
          $ref: '#/components/schemas/event_external_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        face:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/event_face'
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          - description: Event ID.
        url:
          type: string
          format: uri-reference
          example: http://127.0.0.1:5040/2/events/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: Location of event, null if event was not stored.
          nullable: true
        matches:
          allOf:
          - nullable: true
          - items:
              anyOf:
                - allOf:
                  - properties:
                      candidates:
                        items:
                          properties:
                            face:
                              properties:
                                create_time:
                                  type: string
                                  format: date-time
                                  readOnly: true
                                  description: Face creation time.
                  - $ref: '#/components/schemas/match_candidates_faces'
                - $ref: '#/components/schemas/match_candidates_events'
          - $ref: '#/components/schemas/matches'
        location:
          $ref: '#/components/schemas/location'
        detections:
          description: List of body & face related detections.
          type: array
          items:
            $ref: '#/components/schemas/event_detection_samples'
        track_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/track_id'
        meta:
          allOf:
            - $ref: "#/components/schemas/event_meta_common"
          nullable: true
      required: [matches, url, event_id, face, tags, stream_id, source, face_attributes, body_attributes, aggregate_estimations, location, user_data, external_id, detections, track_id, meta]

    Tags:
      description: Tag array.
      type: array
      items:
        $ref: '#/components/schemas/tag'
      example: ['tag1', 'tag2']

    emotions_estimations:
      type: object
      properties:
        anger:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Anger probability.
        disgust:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Disgust probability.
        fear:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Fear probability.
        happiness:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Happiness probability.
        neutral:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Neutral face probability.
        sadness:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Sadness probability.
        surprise:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Surprise probability.
      required: [surprise, sadness, neutral, happiness, fear, disgust, anger]
      description: Emotion classifier response.

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

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

    landmarks5:
      type: array
      items:
        $ref: '#/components/schemas/landmark'
      description: Array of 5 landmarks.
      minItems: 5
      maxItems: 5
      example:
      - - 23
        - 72
      - - 82
        - 71
      - - 42
        - 114
      - - 29
        - 140
      - - 79
        - 138

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

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

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

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

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

    head_pose:
      description: Head pose.
      type: object
      properties:
        yaw:
          type: number
          description: Yaw angle in degrees.
        pitch:
          type: number
          description: Pitch angle in degrees.
        roll:
          type: number
          description: Roll angle in degrees.
      required: [yaw, pitch, roll]

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

    attributes_base:
      description: Face attributes.
      type: object
      properties:
        mouth_attributes:
          allOf:
            - $ref: '#/components/schemas/mouth_attributes'
            - description: Optional mouth attributes.
        eyes_attributes:
          allOf:
            - $ref: '#/components/schemas/eyes_attributes'
            - description: Optional eye attributes.
        emotions:
          allOf:
            - $ref: '#/components/schemas/emotions'
            - description: Face emotions estimation.
        mask:
          $ref: '#/components/schemas/masks'
        head_pose:
          allOf:
            - $ref: '#/components/schemas/head_pose'
            - description: Head pose estimation.
        gaze:
          allOf:
            - $ref: '#/components/schemas/gaze_direction'
            - description: Gaze direction estimation.
        glasses:
          $ref: '#/components/schemas/glasses'
      example:
        mouth_attributes:
          occluded: 0.0
          opened: 0.0
          score: 1.0
          smile: 0.0
        emotions:
          estimations:
            anger: 0.00894705578684807
            disgust: 0.00000965219624049496
            fear: 0.00121302821207792
            happiness: 0.00129503419157118
            neutral: 0.986027479171753
            sadness: 0.00187553185969591
            surprise: 0.000632198702078313
          predominant_emotion: "neutral"
        mask:
          estimations:
            medical_mask: 0.7108324766
            missing: 0.0700698048
            occluded: 0.2190976739
          predominant_mask: medical_mask
          face_occlusion:
            predominant_occlusion: "correct"
            estimations:
              full: 0.1
              correct: 0.25
              clear: 0.05
              mouth: 0.2
              partially: 0.2
              chin: 0.2
        glasses:
          glasses: no_glasses
        head_pose:
          pitch: 18.6827487945557
          roll: -10.3542232513428
          yaw: 15.4102487564087
        gaze:
          pitch: 9.26744079589844
          yaw: -19.4657287597656
        liveness:
          prediction: "spoof"
          estimations:
            score: 0.5108324766
            quality: 1
        deepfake:
          prediction: "real"
          score: 0.5108324766

    face_occlusion:
      description: Face occlusion estimation
      type: object
      properties:
        prediction:
          allOf:
            - $ref: '#/components/schemas/int01'
            - description: overall prediction. A face overlap area is greater or not of `occlusion_threshold`
        estimations:
          description: Estimation scores
          type: object
          properties:
            overall_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: overlapped face area (takin the `hair_occlusion_threshold` parameter).
            hair_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: overlapped face area by hair.
            lower_face_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: |
                    score of overlapped area of a lower face. The area is measuremented relativity of a lower face area 
                    (not all face area), 1 means that all lower face area is overlapped.
            nose_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: |
                    score of overlapped area of a nose. The area is measuremented relativity of a nose area 
                    (not all face area), 1 means that all nose area is overlapped.
            mouth_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: |
                    score of overlapped area of a mouth. The area is measuremented relativity of a mouth area 
                    (not all face area), 1 means that all mouth area is overlapped.
            forehead_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: |
                    score of overlapped area of a forehead. The area is measuremented relativity of a forehead area 
                    (not all face area), 1 means that all overlapped area is overlapped.
            left_eye_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: |
                    score of overlapped area of a left eye. The area is measuremented relativity of a left eye area 
                    (not all face area), 1 means that all left eye area is overlapped
            right_eye_score:
              allOf:
                - $ref: '#/components/schemas/number01'
                - description: |
                    score of overlapped area of a right eye. The area is measuremented relativity of a right eye area 
                    (not all face area), 1 means that all right eye area is overlapped  
          required: [overall_score, hair_score, lower_face_score, nose_score, mouth_score, forehead_score,
                     left_eye_score, right_eye_score]
        face_occlusion:
          description: an occlusion predict by each area
          type: object
          properties:
            lower_face_occluded:
              allOf:
                - $ref: '#/components/schemas/int01'
                - description: lower face is overlapped or not
            mouth_occluded:
              allOf:
                - $ref: '#/components/schemas/int01'
                - description: mouth is overlapped or not
            nose_occluded:
              allOf:
                - $ref: '#/components/schemas/int01'
                - description: nose is overlapped or not
            left_eye_occluded:
              allOf:
                - $ref: '#/components/schemas/int01'
                - description: left eye is overlapped or not
            right_eye_occluded:
              allOf:
                - $ref: '#/components/schemas/int01'
                - description: right eye is overlapped or not
            forehead_occluded:
              allOf:
                - $ref: '#/components/schemas/int01'
                - description: forehead is overlapped or not
          required: [lower_face_occluded, mouth_occluded, nose_occluded, left_eye_occluded, right_eye_occluded,
                     forehead_occluded]
      required: [prediction, estimations, face_occlusion]
      example:
        prediction: 0
        estimations:
          overall_score: 0.01
          hair_score: 0.02
          lower_face_score: 0.012
          nose_score: 0.002
          mouth_score: 0.003
          forehead_score: 0.012
          left_eye_score: 0.032
          right_eye_score: 0.021
        face_occlusion:
          lower_face_occluded: 0
          mouth_occluded: 0
          nose_occluded: 0
          left_eye_occluded: 0
          right_eye_occluded: 0
          forehead_occluded: 0


    attributes:
      allOf:
        - $ref: '#/components/schemas/attributes_base'
        - properties:
            liveness:
              $ref: '#/components/schemas/liveness'
            deepfake:
              $ref: '#/components/schemas/deepfake'
            face_occlusion:
              $ref: '#/components/schemas/face_occlusion'

    rect:
      description: Bounding rectangle.
      type: object
      properties:
        height:
          type: integer
          description: Rectangle height.
          example: 200
        width:
          type: integer
          description: Rectangle width.
          example: 100
        x:
          type: integer
          description: Top left corner "x" coordinate.
          example: 17
        y:
          type: integer
          description: Top left corner "y" coordinate.
          example: 10
      required: [height, width, x, y]
      example:
        height: 240
        width: 209
        x: 170
        y: 198

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

    warped_image:
      type: integer
      description: |
        Whether input image is a warped or arbitrary image.
        The warped image has the following properties: |
        * it's size is always 250x250 pixels.
        * it's always in RGB color format.
        * it always contains just a single face.
        * the face is always centered and rotated so that imaginary line between the eyes is horizontal.

      maximum: 1
      minimum: 0

    detection_filter_reason:
      type: object
      properties:
        filter_name:
          type: string
          enum: ['pitch_threshold', 'roll_threshold', 'yaw_threshold', 'score_threshold', 'mask_states', 'liveness_states' , 'deepfake_states',
                 'image_format', 'illumination_quality', 'specularity_quality', 'blurriness_quality', 'dark_quality',
                 'light_quality', 'head_yaw', 'head_pitch', 'head_roll', 'gaze_yaw', 'gaze_pitch', 'mouth_smiling',
                 'mouth_occluded', 'mouth_open', 'glasses', 'left_eye', 'right_eye', 'head_horizontal_center',
                 'head_vertical_center', 'head_width', 'head_height', 'eye_distance', 'image_width', 'image_height',
                 'aspect_ratio', 'face_width', 'face_height', 'indent_left', 'indent_right', 'indent_upper',
                 'eyebrows_state', 'smile_properties', 'headwear_type', 'natural_light', 'radial_distortion', 'red_eyes',
                 'face_color_type', 'indent_lower', 'image_size', 'illumination_uniformity', 'dynamic_range',
                 'background_lightness', 'background_uniformity', 'shoulders_position', 'face_occlusion_states',
                 'face_occlusion', 'lower_face_occlusion', 'forehead_occlusion', 'nose_occlusion']
          description: |
            Filter name. For resource */detector* available values are: 'pitch_threshold', 'roll_threshold',
            'yaw_threshold', For resources */handlers/{handler_id}/events* and */verifiers/{verifier_id}/verifications* all values are available.
        object_value:
          anyOf:
            - type: integer
              description: Estimate value.
            - type: number
              description: Estimate value.
            - type: string
              description: Estimate value.
            - type: array
              items:
                type: string
              description: Estimate value.
        threshold_value:
          oneOf:
          - type: number
            description: Threshold value.
          - type: array
            items:
              type: integer
            minItems: 1
            description: Threshold values.
          - type: array
            items:
              type: string
            minItems: 1
            description: Threshold values.
          - type: object
            description: Threshold values.
            properties:
              min:
                type: number
                description: Minimum allowed value.
                nullable: true
              max:
                type: number
                description: Maximum allowed value.
                nullable: true

      required:
      - filter_name
      - object_value
      - threshold_value

    extractor_filter:
      type: object
      properties:
        is_filtered:
          type: boolean
          description: True if sample is filtered by a threshold otherwise false.
        filter_reasons:
          type: array
          items:
            type: object
            properties:
              filter_name:
                type: string
                enum: ['score_threshold']
                description: Filter name.
              object_value:
                type: number
                description: Estimate value.
              threshold_value:
                type: number
                description: Threshold value.
            required:
            - filter_name
            - object_value
            - threshold_value
      description: Extractor filters.

    face_quality_checks_reply:
      type: array
      description: Face quality container with all estimates.
      items:
        oneOf:
          - $ref: '#/components/schemas/check_image_format'
          - $ref: '#/components/schemas/check_image_quality'
          - $ref: '#/components/schemas/check_glasses_state'
          - $ref: '#/components/schemas/check_eyes_state'
          - $ref: '#/components/schemas/check_gaze_direction'
          - $ref: '#/components/schemas/check_mouth_state'
          - $ref: '#/components/schemas/check_head_rotation'
          - $ref: '#/components/schemas/check_head_position'
          - $ref: '#/components/schemas/check_head_proportions'
          - $ref: '#/components/schemas/check_eye_distance'
          - $ref: '#/components/schemas/check_image_properties'
          - $ref: '#/components/schemas/check_aspect_ratio'
          - $ref: '#/components/schemas/check_face_properties'
          - $ref: '#/components/schemas/eyebrows_state'
          - $ref: '#/components/schemas/headwear_type'
          - $ref: '#/components/schemas/smile_properties'
          - $ref: '#/components/schemas/natural_light'
          - $ref: '#/components/schemas/radial_distortion'
          - $ref: '#/components/schemas/red_eyes'
          - $ref: '#/components/schemas/face_color_type'
          - $ref: '#/components/schemas/check_face_illumination_uniformity'
          - $ref: '#/components/schemas/background_uniformity'
          - $ref: '#/components/schemas/background_lightness'
          - $ref: '#/components/schemas/shoulders_position_status'
          - $ref: '#/components/schemas/face_occlusion_face_quality'
          - $ref: '#/components/schemas/lower_face_occlusion_face_quality'
          - $ref: '#/components/schemas/nose_occlusion_face_quality'
          - $ref: '#/components/schemas/forehead_occlusion_face_quality'

      minItems: 0
      maxItems: 48
      uniqueItems: true
      example:
        [
          {
            "name": image_format,
            "object_value": JPEG,
            "threshold_value": [ JPEG, JPEG2000, PNG ],
            "result": 1
          },
          {
            "name": illumination_quality,
            "object_value": 0.6005162000656128,
            "threshold_value": { "min": 0.3, "max": 1 },
            "result": 1
          },
          {
            "name": specularity_quality,
            "object_value": 0.7662366628646851,
            "threshold_value": { "min": 0.3, "max": 1 },
            "result": 1
          },
          {
            "name": blurriness_quality,
            "object_value": 0.9429352283477783,
            "threshold_value": { "min": 0.61, "max": 1 },
            "result": 1
          },
          {
            "name": dark_quality,
            "object_value": 0.9020983576774597,
            "threshold_value": { "min": 0.5, "max": 1 },
            "result": 1
          },
          {
            "name": light_quality,
            "object_value": 0.7881984114646912,
            "threshold_value": { "min": 0.57, "max": 1 },
            "result": 1
          },
          {
            "name": head_yaw,
            "object_value": 2.818983316421509,
            "threshold_value": { "min": -5.0, "max": 5.0 },
            "result": 1
          },
          {
            "name": head_pitch,
            "object_value": 3.816443920135498,
            "threshold_value": { "min": -5.0, "max": 5.0 },
            "result": 1
          },
          {
            "name": head_roll,
            "object_value": 5.434040069580078,
            "threshold_value": { "min": -8.0, "max": 8.0 },
            "result": 1
          },
          {
            "name": gaze_yaw,
            "object_value": -3.773012399673462,
            "threshold_value": { "min": -5.0, "max": 5.0 },
            "result": 1
          },
          {
            "name": gaze_pitch,
            "object_value": 0.7140519022941589,
            "threshold_value": { "min": -5.0, "max": 5.0 },
            "result": 1
          },
          {
            "name": mouth_smiling,
            "object_value": 0.000290759839117527,
            "threshold_value": { "min": 0, "max": 0.5 },
            "result": 1
          },
          {
            "name": mouth_occluded,
            "object_value": 9.619363845558837e-05,
            "threshold_value": { "min": 0, "max": 0.5 },
            "result": 1
          },
          {
            "name": mouth_open,
            "object_value": 0.6226108074188232,
            "threshold_value": { "min": 0, "max": 0.5 },
            "result": 1
          },
          {
            "name": glasses,
            "object_value": no_glasses,
            "threshold_value": [ no_glasses, eyeglasses ],
            "result": 1
          },
          {
            "name": left_eye,
            "object_value": open,
            "threshold_value": [ open ],
            "result": 1
          },
          {
            "name": right_eye,
            "object_value": open,
            "threshold_value": [ open ],
            "result": 1
          },
          {
            "name": head_horizontal_center,
            "object_value": 0.51,
            "threshold_value": { "min": 0.45, "max": 0.55 },
            "result": 1
          },
          {
            "name": head_vertical_center,
            "object_value": 0.51,
            "threshold_value": { "min": 0.3, "max": 0.5 },
            "result": 1
          },
          {
            "name": head_width,
            "object_value": 0.61,
            "threshold_value": { "min": 0.5, "max": 0.75 },
            "result": 1
          },
          {
            "name": head_height,
            "object_value": 0.71,
            "threshold_value": { "min": 0.6, "max": 0.9 },
            "result": 1
          },
          {
            "name":eye_distance,
            "object_value": 110,
            "threshold_value": { "min": 90, "max": null },
            "result": 1
          },
          {
            "name": image_width,
            "object_value": 1000,
            "threshold_value": { "min": 200, "max": 1100 },
            "result": 1
          },
          {
            "name": image_height,
            "object_value": 2000,
            "threshold_value": { "min": 200, "max": 1100 },
            "result": 1
          },
          {
            "name": aspect_ratio,
            "object_value": 0.5,
            "threshold_value": { "min": 0.1, "max": 1.0 },
            "result": 1
          },
          {
            "name": face_width,
            "object_value": 500,
            "threshold_value": { "min": 400, "max": 600 },
            "result": 1
          },
          {
            "name": face_height,
            "object_value": 500,
            "threshold_value": { "min": 400, "max": 600 },
            "result": 1
          },
          {
            "name": indent_left,
            "object_value": 100,
            "threshold_value": { "min": 10, "max": 500 },
            "result": 1
          },
          {
            "name": indent_right,
            "object_value": 100,
            "threshold_value": { "min": 10, "max": 500 },
            "result": 1
          },
          {
            "name": indent_upper,
            "object_value": 100,
            "threshold_value": { "min": 10, "max": 500 },
            "result": 1
          },
          {
            "name": indent_lower,
            "object_value": 100,
            "threshold_value": { "min": 10, "max": 500 },
            "result": 1
          },
          {
            "name": image_size,
            "object_value": 100500,
            "threshold_value": { "min": 10, "max": 100600 },
            "result": 1
          },
          {
            "name": eyebrows_state,
            "object_value": "neutral",
            "threshold_value": ["neutral"],
            "result": 1
          },
          {
            "name": smile_properties,
            "object_value": "smile_lips",
            "threshold_value": ["none"],
            "result": 0
          },
          {
            "name": headwear_type,
            "object_value": "hat",
            "threshold_value": ["none"],
            "result": 0
          },
          {
            "name": natural_light,
            "object_value": 1,
            "threshold_value": 1,
            "result": 1
          },
          {
            "name": radial_distortion,
            "object_value": 0,
            "threshold_value": 0,
            "result": 1
          },
          {
            "name": red_eyes,
            "object_value": 0,
            "threshold_value": 0,
            "result": 1
          },
          {
            "name": face_color_type,
            "object_value": "color",
            "threshold_value": ["color"],
            "result": 1
          },
          {
            "name": illumination_uniformity,
            "object_value": 0.4305162000656128,
            "threshold_value": { "min": 0.5, "max": 1.0 },
            "result": 1
          },
          {
            "name": dynamic_range,
            "object_value": 0.7605162000656128,
            "threshold_value": { "min": 0.5, "max": 1.0 },
            "result": 1
          },
          {
            "name": background_lightness,
            "object_value": 0.5780888795852661,
            "threshold_value": { "min": 0.2, "max": 1.0 },
            "result": 1
          },
          {
            "name": background_uniformity,
            "object_value": 0.8874394297599792,
            "threshold_value": { "min": 0.5, "max": 1.0 },
            "result": 1
          },
          {
            "name": shoulders_position,
            "object_value": 'parallel',
            "threshold_value": ['parallel'],
            "result": 1
          }
        ]

    face_quality_checks_estimations:
      type: object
      description: Face quality estimations checks.
      properties:
        status:
          type: integer
          enum: [ 0, 1 ]
          description: Check status for all estimates.
        checks:
          $ref: '#/components/schemas/face_quality_checks_reply'
      required: [ status, checks ]

    face_detection_base:
      type: object
      description: Face detection.
      properties:
        quality:
          allOf:
            - $ref: '#/components/schemas/quality'
            - description: Image quality estimation for this face detection region.
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: Face detection bounding box.
        landmarks5:
          allOf:
            - $ref: '#/components/schemas/landmarks5'
            - description: Facial landmarks.
        landmarks68:
          allOf:
            - $ref: '#/components/schemas/landmarks68'
            - description: Facial landmarks.
        face_quality:
          allOf:
            - $ref: '#/components/schemas/face_quality_checks_estimations'
          description: Face quality checks estimations.

    face_detection:
      allOf:
        - $ref: '#/components/schemas/face_detection_base'
        - properties:
            attributes:
              allOf:
              - $ref: '#/components/schemas/attributes'
              - description: Face attributes estimation.

    detector_face_detection:
      allOf:
        - $ref: '#/components/schemas/face_detection_base'
        - properties:
            attributes:
              allOf:
              - $ref: '#/components/schemas/attributes_base'
              - description: Face attributes estimation.

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

    body_detection_base:
      type: object
      description: Body detection.
      properties:
        rect:
          allOf:
          - $ref: '#/components/schemas/rect'
          - description: Body detection bounding box.
        attributes:
          type: object
          description: Body attributes.
          properties:
            basic_attributes:
              $ref: '#/components/schemas/body_basic_attributes_not_nullable'
            upper_body:
              $ref: '#/components/schemas/upper_body_attributes_base'
            lower_body:
              $ref: '#/components/schemas/lower_body_attributes_not_nullable'
            accessories:
              $ref: '#/components/schemas/body_accessories_not_nullable'

    body_detection:
      allOf:
        - $ref: '#/components/schemas/body_detection_base'
        - properties:
            attributes:
              properties:
                upper_body:
                  $ref: '#/components/schemas/estimated_upper_body_attributes'


    input_body_detection:
      $ref: '#/components/schemas/body_detection_base'


    event_body_detection:
      type: object
      description: Saved with event body detection.
      properties:
        rect:
          allOf:
            - $ref: '#/components/schemas/rect'
            - description: Body detection bounding box.
    exif:
      description: |
        select image EXIF tags.
        See [CIPA DC-008-2016]( http://www.cipa.jp/std/documents/e/DC-008-Translation-2016-E.pdf) for details.
        Tag to string conversions is handled by libEXIF.
      type: object
      properties:
        make:
          type: string
          description: Make tag (IFD0 0x010f).
        model:
          type: string
          description: Model tag (IFD0 0x0110).
        gps:
          type: object
          description: GPS tag (IFD 0x8825).
          properties:
            latitude:
              type: string
              description: GPS latitude (IFD GPS 0x0002).
            longitude:
              type: string
              description: GPS longitude (IFD GPS 0x0004).
          required: [latitude, longitude]
        artist:
          type: string
          description: Artist tag (IFD0 0x013b).
        software:
          type: string
          description: Software tag (IFD0 0x0131).
        flash:
          type: string
          description: Flash tag (IFD_EXIF 0x9209).
        orientation:
          type: integer
          description: Orientation (IFD0 0x0112).
      example:
        software: "Adobe Photoshop CS5 Macintosh"

    face_detection_sample_base:
      type: object
      description: Face detection sample.
      properties:
        sample_id:
          $ref: '#/components/schemas/sample_id'
        url:
          type: string
          nullable: true
          format: uri-reference
          example: http://127.0.0.1:5020/1/buckets/visionlabs-samples/images/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
          description: Location of the sample, null if sample was not stored.
      required:
      - detection
      - sample_id
      - url

    face_detection_sample:
      allOf:
        - $ref: '#/components/schemas/face_detection_sample_base'
        - properties:
            detection:
              $ref: '#/components/schemas/face_detection'
      required:
        - detection

    detector_face_detection_sample:
      allOf:
        - $ref: '#/components/schemas/face_detection_sample_base'
        - properties:
            detection:
              $ref: '#/components/schemas/detector_face_detection'
      required:
        - detection

    body_detection_sample:
      type: object
      description: Body detection sample.
      properties:
        sample_id:
          $ref: '#/components/schemas/sample_id'
        detection:
          $ref: '#/components/schemas/body_detection'
        url:
          type: string
          nullable: true
          format: uri-reference
          example: /0/samples/bodies/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
          description: Location of the sample, null if sample was not stored.
      required:
        - detection
        - sample_id
        - url

    input_event_body_detection_sample:
      type: object
      description: Face detection sample.
      properties:
        sample_id:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/sample_id'
        detection:
          $ref: '#/components/schemas/input_body_detection'
        url:
          description: |
            User saved body sample location. If user does not set it and sample id is not null it will
            be generated automatically.
          example:
            http://127.0.0.1:5020/2/buckets/123/images/45838c8b-04a1-4230-bda0-b5f77609b695
          allOf:
            - $ref: '#/components/schemas/input_url'
      required:
      - detection
      - sample_id

    filename:
      type: string
      example: "penelope.jpeg"
      description: |
        Source image file name (preserved only for multipart-form-data requests, otherwise "Raw Image").

    image_status:
      type: integer
      enum: [0, 1]
      description: Image status. 0 - processing image is failed, 1 - success image processed.

    verification_status:
      type: boolean
      description: |
        Status of verification. `true` - the service assumes that a reference and candidates are same person.

    detector_filtered_detections:
      type: object
      properties:
        face_detections:
          type: array
          items:
            type: object
            description: Filtered detection.
            properties:
              filter_reasons:
                type: array
                items:
                  $ref: '#/components/schemas/detection_filter_reason'
                minItems: 1
              detection:
                $ref: '#/components/schemas/detector_face_detection'
            required: [filter_reasons, detection]
      required: [face_detections]

    verifier_filtered_detections:
      type: object
      properties:
        face_detections:
          type: array
          items:
            type: object
            description: Filtered detection.
            properties:
              filter_reasons:
                type: array
                items:
                  $ref: '#/components/schemas/detection_filter_reason'
                minItems: 1
              detection:
                type: object
                properties:
                  filename:
                    $ref: '#/components/schemas/filename'
                  sample:
                    type: object
                    properties:
                      detection:
                        $ref: '#/components/schemas/face_detection'
                    required: [detection]
                required: [filename, sample]
            required: [filter_reasons, detection]
      required: [face_detections]

    processed_image:
      type: object
      description: |
        Processed image. Status 1 means that the image was processed without errors. Status 0 means
        that the image was processed with errors, information about error is contained in field `error`
        (error `Success` means that image was processed without errors with status `1`).
      properties:
        filename:
          allOf:
            - $ref: '#/components/schemas/filename'
          description: Source image file name.
        status:
          $ref: '#/components/schemas/image_status'
        error:
          allOf:
            - $ref: '#/components/schemas/Error'
            - example:
                error_code: 11027
                desc: External request failed
                detail: 'Failed  to download image by url ''https://www.gooogle.ru'''
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027"
        exif:
          $ref: '#/components/schemas/exif'
      required: [filename, status, error]

    detector_samples:
      type: object
      properties:
        face:
          allOf:
          - $ref: '#/components/schemas/detector_face_detection_sample'
          - description: Face detection.
      description: Only face sample now.

    detector_detections:
      type: object
      description: |
        All detections on image which are separated on samples (entity for followig a descriptor extraction) and
        filtered detections (it is debug information).
      properties:
        samples:
          type: array
          items:
            $ref: '#/components/schemas/detector_samples'
          description: Detections list which satisfy filters criteria.
        filtered_detections:
          $ref: '#/components/schemas/detector_filtered_detections'
      required: [samples, filtered_detections]

    detected_image:
      allOf:
      - $ref: '#/components/schemas/processed_image'
      - type: object
        properties:
          detections:
            $ref: '#/components/schemas/detector_detections'
        required: [detections]
      - description: Processed image from detector.

    detected_images:
      type: object
      description: Processed images from detector.
      properties:
        images:
          type: array
          items:
            $ref: '#/components/schemas/detected_image'
          description: Proceeded images list.
      required: [images]

    people_coordinates:
      type: array
      description: People coordinates estimation
      items:
        type: array
        items:
          type: integer
          minItems: 2
          maxItems: 2
        description: Human x, y coordinates
        example: [64, 128]

    handler_processed_images:
      type: array
      description: Processed images from a handler.
      items:
        allOf:
          - $ref: '#/components/schemas/processed_image'
          - properties:
              image_estimations:
                type: object
                description: Image estimations.
                properties:
                  people:
                    type: object
                    properties:
                      count:
                        type: integer
                        description: People count estimation. As an approximate value, it may differ from a face and body detection count per image for images with a lot of people.
                      coordinates:
                        allOf:
                          - $ref: '#/components/schemas/people_coordinates'
                        nullable: true

    event_filtered_detections:
      type: object
      properties:
        face_detections:
          type: array
          items:
            type: object
            properties:
              filter_reasons:
                type: array
                items:
                  $ref: '#/components/schemas/detection_filter_reason'
                minItems: 1
              detection:
                type: object
                properties:
                  filename:
                    $ref: '#/components/schemas/filename'
                  sample:
                    type: object
                    properties:
                      detection:
                        $ref: '#/components/schemas/face_detection'
                    required: [detection]
                required: [filename, sample]
            required: [filter_reasons, detection]
      required: [face_detections]

    emit_event_reply:
      type: object
      properties:
        events:
          type: array
          items:
            $ref: '#/components/schemas/EventFromHandler'
        images:
          $ref: '#/components/schemas/handler_processed_images'
        filtered_detections:
          $ref: '#/components/schemas/event_filtered_detections'
      required: ["events", "images", "filtered_detections"]

    ethnicities_estimations:
      type: object
      description: Ethnicity classifier response.
      properties:
        asian:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Asian ethnicity probability.
        indian:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Indian ethnicity probability.
        caucasian:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: Caucasian ethnicity probability.
        african_american:
          type: number
          format: double
          maximum: 1
          minimum: 0
          description: African American ethnicity probability.
      required: [african_american, caucasian, indian, asian]

    ethnicities:
      description: Estimated ethnicities.
      type: object
      properties:
        estimations:
          allOf:
          - $ref: '#/components/schemas/ethnicities_estimations'
          - description: Ethnicity classifier response.
        predominant_ethnicity:
          type: string
          description: name of predominant ethnicity.
      required: [estimations, predominant_ethnicity]
      example:
        estimations:
          african_american: 1.92238889737406e-12
          asian: 0.954671621322632
          caucasian: 0.045328326523304
          indian: 7.65100649502415e-10
        predominant_ethnicity: "asian"

    basic_attributes:
      type: object
      description: Basic attributes.
      properties:
        age:
          allOf:
            - $ref: '#/components/schemas/age'
            - example: 29
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
            - example: 1

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

    attribute_samples:
      type: array
      items:
        $ref: '#/components/schemas/sample_id'
      minItems: 0
      example: [ 'a3e8716f-70dc-42ad-8428-7a552e800a37' ]
      description: Resource for attributes.

    extracted_face_attributes:
      type: object
      description: Extracted face attributes from samples.
      properties:
        filter:
          $ref: '#/components/schemas/extractor_filter'
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
            - $ref: '#/components/schemas/number01'
          description: Face descriptor quality score.
        samples:
          allOf:
            - description: Face samples.
            - $ref: '#/components/schemas/samples'
      required: [samples]

    reextracted_face_attribute:
      type: object
      properties:
        face_id:
          nullable: true
          allOf:
            - description: Face ID, null if descriptor score is lower than score threshold.
            - $ref: '#/components/schemas/face_id'
        url:
          nullable: true
          type: string
          format: uri-reference
          example: http://127.0.0.1:5030/3/faces/24d405ce-bc56-4bf7-98e1-bdc962b4cf34/attributes
          description: Location of attributes, null if attribute was not stored.
        face_attributes:
          $ref: '#/components/schemas/extracted_face_attributes'
      required: [face_id, url, face_attributes]

    reextracted_event_attribute:
      type: object
      properties:
        event_id:
          allOf:
          - $ref: '#/components/schemas/event_id'
          - description: Event ID, null if descriptor score is lower than score threshold.
          nullable: true
        url:
          nullable: true
          type: string
          format: uri-reference
          example: http://127.0.0.1:5040/2/events/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: Location of the event which attributes were updated.
        face_attributes:
          $ref: '#/components/schemas/extracted_face_attributes'
        body_attributes:
          type: object
          description: Extracted body attributes from samples.
          properties:
            samples:
              allOf:
                - description: Face samples.
                - $ref: '#/components/schemas/samples'
            score:
              allOf:
                - $ref: '#/components/schemas/number01'
              description: Face descriptor quality score.
          required: [samples, score]
      required: [event_id, url]

    reextracted_attribute:
      oneOf:
        - $ref: '#/components/schemas/reextracted_face_attribute'
        - $ref: '#/components/schemas/reextracted_event_attribute'

    attribute:
      type: object
      properties:
        attribute_id:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/attribute_id'
            - description: Attribute ID, null if descriptor score is lower than score threshold.
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: Face descriptor quality score.
        url:
          nullable: true
          type: string
          format: uri-reference
          example: http://127.0.0.1:5030/3/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: Location of attributes, null if attribute was not stored.
        samples:
          $ref: '#/components/schemas/attribute_samples'
        filter:
          $ref: '#/components/schemas/extractor_filter'

      required: [attribute_id, url, samples]

    input_event_face_attribute:
      type: object
      description: User extracted event face attributes.
      nullable: true
      properties:
        attribute_id:
          $ref: '#/components/schemas/attribute_id'
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          default: 1
          allOf:
            - $ref: '#/components/schemas/number01'
          description: Face descriptor quality score.
        samples:
          minItems: 0
          maxItems: 8
          allOf:
          - $ref: '#/components/schemas/attribute_samples'
        descriptor:
          $ref: '#/components/schemas/sdk_descriptor'
        url:
          description: |
            Attributes location url. If user does not set it and `attribute_id` is not null service will generates
            it automatically.
          allOf:
            - $ref: '#/components/schemas/input_url'

    BodyAttribute:
      type: object
      properties:
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: |
            Body descriptor quality score.
            > **WARNING** If body descriptor was extracted, the value is always set to 1.
        samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          example: ['a3e8716f-70dc-42ad-8428-7a552e800a37']
          description: Stored attribute samples.

      required: [samples]

    input_event_body_attribute:
      type: object
      description: User extracted event body attributes.
      nullable: true
      properties:
        score:
          allOf:
            - $ref: '#/components/schemas/number01'
          description: Body descriptor quality score.
        samples:
          $ref: '#/components/schemas/attribute_samples'
        descriptor:
          $ref: '#/components/schemas/sdk_descriptor'

    extracted_attributes:
      type: array
      items:
        $ref: '#/components/schemas/attribute'

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

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

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

    candidate_event:
      type: object
      description: Event candidate object in the response.
      properties:
        event_id:
          $ref: '#/components/schemas/event_id'
        account_id:
          $ref: '#/components/schemas/face_id'
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: Time of the event creation.
        end_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: The end time of the event.
        external_id:
          $ref: '#/components/schemas/event_external_id'
        handler_id:
          $ref: '#/components/schemas/handler_id'
        source:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/source'
        stream_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/stream_id'
        top_match:
          nullable: true
          description: Top match result from match policy.
          oneOf:
            - $ref: '#/components/schemas/top_match_face'
            - $ref: '#/components/schemas/top_match_event'
        match_result:
          type: array
          nullable: true
          description: Saved event matches by faces or events.
          items:
            $ref: '#/components/schemas/event_match_result'
        face_detections:
          nullable: true
          type: array
          items:
            type: object
            properties:
              sample_id:
                $ref: '#/components/schemas/sample_id'
              detection:
                $ref: '#/components/schemas/event_face_detection'
              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]
        body_detections:
          nullable: true
          type: array
          items:
            type: object
            properties:
              sample_id:
                $ref: '#/components/schemas/sample_id'
              detection:
                $ref: '#/components/schemas/event_body_detection'
              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]
        body_basic_attributes:
          allOf:
          - $ref: '#/components/schemas/body_basic_attributes'
          - nullable: true
        upper_body:
          $ref: '#/components/schemas/saved_event_upper_body_attributes'
        lower_body:
          allOf:
            - $ref: '#/components/schemas/lower_body_attributes'
            - nullable: true
        accessories:
          allOf:
          - $ref: '#/components/schemas/body_accessories'
          - nullable: true
        face_id:
          allOf:
            - $ref: '#/components/schemas/face_id'
            - nullable: true
        attach_result:
          type: array
          items:
            $ref: '#/components/schemas/list_id'
          nullable: true
        gender:
          allOf:
            - $ref: '#/components/schemas/gender'
            - nullable: true
        age:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/age'
        emotion:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/emotion'
        liveness:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/liveness_state'
        deepfake:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/deepfake_state'
        mask:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/mask'
        ethnic_group:
          allOf:
          - $ref: '#/components/schemas/ethnic_group'
          - nullable: true
        tags:
          nullable: true
          allOf:
          - $ref: '#/components/schemas/tags'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        location:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/location'
        track_id:
          allOf:
            - nullable: true
            - $ref: '#/components/schemas/track_id'
        meta:
          allOf:
            - nullable: true
            - $ref: "#/components/schemas/event_meta_common"

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

    match_candidates_faces:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        candidates:
          type: array
          description: List of faces candidates.
          items:
            $ref: '#/components/schemas/candidate_match_result_face'
      required: [label, candidates]

    match_candidates_events:
      type: object
      properties:
        label:
          $ref: '#/components/schemas/top_matching_candidates_label'
        candidates:
          type: array
          description: List of events candidates.
          items:
            $ref: '#/components/schemas/Candidate_Match_Result_Event'
      required: [label, candidates]

    match_candidates_face_in_event_candidates_in_target_match_result:
      type: object
      properties:
        face:
          type: object
          properties:
            face_id:
              allOf:
                - $ref: '#/components/schemas/face_id'
                - nullable: true
            user_data:
              allOf:
                - $ref: '#/components/schemas/face_user_data'
                - nullable: true
            create_time:
              allOf:
                - $ref: '#/components/schemas/create_time'
                - nullable: true
            external_id:
              allOf:
                - $ref: '#/components/schemas/face_external_id'
                - nullable: true
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: Face candidate similarity.
      required: [face, similarity]

    create_time:
      allOf:
        - $ref: "#/components/schemas/time"
        - description: Time of the object creation.

    match_candidates_events_in_event_candidates_in_target_match_result:
      type: object
      description: Event candidate object in the response.
      properties:
        event:
          type: object
          properties:
            event_id:
              allOf:
                - $ref: '#/components/schemas/event_id'
                - nullable: true
            user_data:
              allOf:
              - $ref: '#/components/schemas/event_user_data'
              nullable: true
            create_time:
              allOf:
                - $ref: '#/components/schemas/create_time'
                - nullable: true
            external_id:
              allOf:
                - $ref: '#/components/schemas/event_external_id'
                - nullable: true
            handler_id:
              allOf:
                - $ref: '#/components/schemas/handler_id'
                - nullable: true
            source:
              allOf:
                - $ref: '#/components/schemas/source'
                - nullable: true
            stream_id:
              allOf:
                - $ref: '#/components/schemas/stream_id'
                - nullable: true
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: Event candidate similarity.
      required: [event, similarity]

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

    match_candidates_reply:
      anyOf:
        - $ref: '#/components/schemas/match_candidates_faces'
        - $ref: '#/components/schemas/match_candidates_events'

    matches:
      description: Sorted list with match result for the event.
      type: array
      items:
        $ref: '#/components/schemas/match_candidates_reply'
      example:
        [{
           label: good guys,
           candidates: [{
                          face:{
                            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
                          },
                          similarity: 0.5
                        }]},
         {
           label: bad guys,
           candidates: [{
                          event:{
                            event_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7,
                            external_id: 2xQ2gprbMUePw1s9gw9fvA==,
                            user_data: fox1991,
                            create_time: "2018-08-11T09:11:41.674Z",
                            handler_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7,
                            source: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7,
                            stream_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                          },
                          similarity: 0.3
                        }]}]

    trusted_detections:
      allOf:
        - description: |
            Whether detections were received with VL algorithms or not.
            
            **Note that enabling this parameter with detections from external sources may affect estimations in an unexpected way**.
        - default: 0
        - $ref: '#/components/schemas/int01'

    json_with_base_64_image:
      type: object
      properties:
        image:
          type: string
          description: Image in base64.
        mimetype:
          type: string
          enum: [ "image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
                  "image/x-portable-pixmap-base64" ]
          description: Image mimetype.
        face_bounding_boxes:
          allOf:
            - description: Array with face bounding boxes for image (now support only 1 bounding box).
            - $ref: '#/components/schemas/base_bounding_boxes'
        trusted_detections:
          $ref: '#/components/schemas/trusted_detections'
      required: [ image, mimetype ]

    detector_json_with_base_64_image:
      allOf:
        - $ref: '#/components/schemas/json_with_base_64_image'
      required: [image, mimetype, face_bounding_boxes]

    sdk_json_with_base_64_image:
      allOf:
        - $ref: '#/components/schemas/json_with_base_64_image'
        - properties:
            body_bounding_boxes:
              allOf:
                - description: Array with body bounding boxes for image (now support only 1 bounding box).
                - $ref: '#/components/schemas/base_bounding_boxes'

    mimetype:
      type: string
      enum: ["image/x-jpeg-base64", "image/x-png-base64", "image/x-bmp-base64", "image/x-tiff-base64",
             "image/x-portable-pixmap-base64", "application/x-sdk-descriptor-base64", "application/x-vl-xpk-base64"]
      description: Base 64 encoded image/descriptor mimetype.

    handler_json_with_base_64:
      type: object
      properties:
        image:
          type: string
          description: Image or raw descriptor in base64.
        content_type:
          $ref: '#/components/schemas/mimetype'
        detect_time:
          $ref: '#/components/schemas/detect_time'
        detect_ts:
          $ref: "#/components/schemas/detect_ts"
        face_bounding_boxes:
          allOf:
            - description: Array with face bounding boxes for image (now support only 1 bounding box).
            - $ref: '#/components/schemas/base_bounding_boxes'
        body_bounding_boxes:
          allOf:
            - description: Array with body bounding boxes for image (now support only 1 bounding box).
            - $ref: '#/components/schemas/base_bounding_boxes'
        image_origin:
          $ref: '#/components/schemas/image_origin_not_nullable_base64_json'
        image_origin_mimetype:
          $ref: '#/components/schemas/image_origin_mimetype'
        meta:
          $ref: '#/components/schemas/event_meta_common'
        trusted_detections:
          $ref: '#/components/schemas/trusted_detections'
      example:
        image: string
        mimetype: image/x-jpeg-base64
        detect_time: 2018-08-11T09:11:41.674Z
        detect_ts: 123.456
        face_bounding_boxes:
          - height: 240
            width: 209
            x: 170
            y: 198
        body_bounding_boxes:
          - height: 240
            width: 209
            x: 170
            y: 198
        image_origin: /6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e
        meta:
          key: value
        trusted_detections: 1
      required: [image, mimetype]

    verify_json_with_base_64:
      type: object
      properties:
        image:
          type: string
          description: Image or raw descriptor in base64.
        mimetype:
          $ref: '#/components/schemas/mimetype'
        face_bounding_boxes:
          allOf:
            - description: Array with face bounding boxes for image (now support only 1 bounding box).
            - $ref: '#/components/schemas/base_bounding_boxes'
        trusted_detections:
          $ref: '#/components/schemas/trusted_detections'
      required: [ image, mimetype ]

    url_for_detection:
      type: object
      description: URL object for processing pipeline.
      properties:
        url:
          type: string
          format: uri-reference
          description: Image url.
          example: "https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg"
        face_bounding_boxes:
          allOf:
            - description: Array with face bounding boxes for image (now support only 1 bounding box for each image).
            - $ref: '#/components/schemas/base_bounding_boxes'
        trusted_detections:
          $ref: '#/components/schemas/trusted_detections'
      required: [ url ]

    json_request_body_urls:
      type: object
      properties:
        urls:
          type: array
          items:
            $ref: '#/components/schemas/url_for_detection'
          minItems: 1
          maxItems: 8
      required: [urls]

    handler_json_request_body_urls:
      type: object
      description: URLs object for generated events.
      properties:
        urls:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/url_for_detection'
              - properties:
                  body_bounding_boxes:
                    allOf:
                      - description: Array with body bounding boxes for image (now support only 1 bounding box for each image).
                      - $ref: '#/components/schemas/base_bounding_boxes'
                  detect_time:
                    $ref: '#/components/schemas/detect_time'
                  detect_ts:
                    $ref: "#/components/schemas/detect_ts"
                  image_origin:
                    $ref: '#/components/schemas/image_origin_not_nullable_base64_json'
                  image_origin_mimetype:
                    $ref: '#/components/schemas/image_origin_mimetype'
                  meta:
                    $ref: '#/components/schemas/event_meta_common'
          minItems: 1
          maxItems: 8
        meta:
          allOf:
            - $ref: '#/components/schemas/event_meta_common'
          description: |
            Mutual event meta.
            If no particular meta is specified for an individual URL, the mutual meta will be used for it.
            For requests with aggregation, only the mutual meta will be set for the aggregated event, and particular ones will be ignored.
      example:
        urls:
          - url: https://upload.wikimedia.org/wikipedia/commons/thumb/c/c4/Abbey_Lee_2015.jpg/800px-Abbey_Lee_2015.jpg
            face_bounding_boxes:
              - height: 240
                width: 209
                x: 170
                y: 198
            body_bounding_boxes:
              - height: 240
                width: 209
                x: 170
                y: 198
            detect_time: 2018-08-11T09:11:41.674Z
            detect_ts: 123.456
            image_origin: /6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e
            meta:
              key: value
            trusted_detections: 1
        meta:
          key: value
      required: [ urls ]

    sdk_json_request_body_urls:
      type: object
      properties:
        urls:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/url_for_detection'
              - properties:
                  body_bounding_boxes:
                    allOf:
                      - description: Array with body bounding boxes for image (now support only 1 bounding box for each image).
                      - $ref: '#/components/schemas/base_bounding_boxes'
            required: [ url ]
          minItems: 1
          maxItems: 8
      required: [ urls ]

    list_samples:
      type: object
      properties:
        samples:
          type: array
          items:
            allOf:
            - $ref: '#/components/schemas/sample_id'
          minItems: 1
          maxItems: 8
          description: |
            List of sample IDs.

            > **WARNING** The type of samples is determined by *`image_type`* / *`warped_image`* parameter.
            The detector stage of image processing pipeline is triggered for non-warped images and skipped for warps.

          example:
          - "c724fea1-d1bb-44c5-af6d-9833d22f3eb7"
          - "f78c6156-3946-4767-be65-4748f25aefd4"
      required: [samples]

    sample_for_detection:
      type: object
      description: Samples object with detection time.
      properties:
        sample_id:
          $ref: '#/components/schemas/sample_id_not_null'
        detect_time:
          $ref: '#/components/schemas/detect_time'
        detect_ts:
          $ref: "#/components/schemas/detect_ts"
        image_origin:
          $ref: '#/components/schemas/image_origin_not_nullable_base64_json'
        image_origin_mimetype:
          $ref: '#/components/schemas/image_origin_mimetype'
        meta:
          $ref: '#/components/schemas/event_meta_common'
      example:
        samples:
          - sample_id: c724fea1-d1bb-44c5-af6d-9833d22f3eb7
            detect_time: 2018-08-11T09:11:41.674Z
            detect_ts: 123.456
            image_origin: /6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e
            meta:
              key: value
      required: [sample_id]

    samples_for_detection:
      type: object
      description: Samples including their ids and detection time for processing pipeline.
      properties:
        samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_for_detection'
          minItems: 1
          maxItems: 8
          description: List of sample object with ids and detection time.
        meta:
          allOf:
            - $ref: '#/components/schemas/event_meta_common'
          description: |
            Mutual event meta.
            If no particular meta is specified for an individual sample, the mutual meta will be used for it.
            For requests with aggregation, only the mutual meta will be set for the aggregated event, and particular ones will be ignored.
      required: [samples]
      example:
        samples:
          - sample_id: "c724fea1-d1bb-44c5-af6d-9833d22f3eb7"
            detect_time: "2018-08-11T09:11:41.674Z"
            detect_ts: 123.456
            image_origin: "/6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e"
            meta:
              key: value

    emit_event_json_request_body:
      oneOf:
        - $ref: '#/components/schemas/handler_json_with_base_64'
        - $ref: '#/components/schemas/handler_json_request_body_urls'
        - $ref: '#/components/schemas/list_samples'
        - $ref: '#/components/schemas/samples_for_detection'

    detect_json_request_body:
      oneOf:
        - $ref: '#/components/schemas/detector_json_with_base_64_image'
        - $ref: '#/components/schemas/json_request_body_urls'
        - $ref: '#/components/schemas/list_samples'

    sdk_json_request_body:
      oneOf:
        - $ref: '#/components/schemas/sdk_json_with_base_64_image'
        - $ref: '#/components/schemas/sdk_json_request_body_urls'
        - $ref: '#/components/schemas/list_samples'

    verify_json_request_body:
      oneOf:
        - $ref: '#/components/schemas/verify_json_with_base_64'
        - $ref: '#/components/schemas/json_request_body_urls'
        - $ref: '#/components/schemas/list_samples'

    image:
       type: string
       format: binary or byte

    base_bounding_boxes:
      type: array
      description: Array with bounding boxes.
      items:
        $ref: '#/components/schemas/rect'
      minItems: 1

    face_bounding_boxes:
       type: array
       description: Map with image filenames and arrays of face bounding boxes.
       items:
         type: object
         properties:
           filename:
             type: string
             description: Image filename. It must be the same as one of 'image' request part filename
           face_bounding_boxes:
              allOf:
                - description: Array with face bounding boxes for image (now support only 1 bounding box).
                - $ref: '#/components/schemas/base_bounding_boxes'
         required: [filename, face_bounding_boxes]
       minItems: 1

    body_bounding_boxes:
      type: array
      description: Map with image filenames and arrays of body bounding boxes.
      items:
        type: object
        properties:
          filename:
            type: string
            description: Image filename. It must be the same as one of 'image' request part filename
          body_bounding_boxes:
            allOf:
              - description: Array with body bounding boxes for image (now support only 1 bounding box).
              - $ref: '#/components/schemas/base_bounding_boxes'
        required: [filename, body_bounding_boxes]
      minItems: 1

    multipart_image_schema:
      type: object
      properties:
        image:
          $ref: '#/components/schemas/image_list_for_multipart'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
      required: [image]

    multipart_raw_data_schema_with_policies:
      type: object
      properties:
        policies:
          $ref: '#/components/schemas/Policies'
        image:
          $ref: '#/components/schemas/raw_data_list_for_multipart'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
        body_bounding_boxes:
          $ref: '#/components/schemas/body_bounding_boxes'
        image_detect_time:
          $ref: '#/components/schemas/image_detect_time'
        image_detect_ts:
          $ref: "#/components/schemas/image_detect_ts"
        image_origin:
          $ref: '#/components/schemas/image_origin_list'
        meta:
          allOf:
            - $ref: '#/components/schemas/event_meta'
          description: |
            Either a mutual event meta or a list of particular metas for individual images.
            For requests with aggregation, only the mutual meta will be set for the aggregated event, and particular ones will be ignored.
      required: [image]

    multipart_verifier_payload:
      type: object
      properties:
        image:
          $ref: '#/components/schemas/raw_data_list_for_multipart'
        face_bounding_boxes:
          $ref: '#/components/schemas/face_bounding_boxes'
      required: [image]

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

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

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

    masks_base:
      type: object
      description: Estimated face mask state.
      properties:
        estimations:
          $ref: '#/components/schemas/mask_estimations'
        predominant_mask:
          $ref: '#/components/schemas/mask_predominant'
        face_occlusion:
          type: object
          description: Estimated face occlusion.
          properties:
            predominant_occlusion:
              type: string
              enum: ["full", "clear", "correct", "partially", "mouth", "chin"]
              description: The most likely face occlusion state.
            estimations:
              type: object
              description: Raw face occlusion estimations scores.
              properties:
                full:
                  allOf:
                  - $ref: '#/components/schemas/number01'
                  description: The probability that the mask occlude whole face.
                clear:
                  allOf:
                  - $ref: '#/components/schemas/number01'
                  description: The probability that the mask absent.
                correct:
                  allOf:
                  - $ref: '#/components/schemas/number01'
                  description: The probability that the mask is put on correctly.
                partially:
                  allOf:
                  - $ref: '#/components/schemas/number01'
                  description: The probability that the mask is put on partially correct.
                mouth:
                  allOf:
                  - $ref: '#/components/schemas/number01'
                  description: The probability that the mask is put on mouth only.
                chin:
                  allOf:
                  - $ref: '#/components/schemas/number01'
                  description: The probability that the mask is put on chin only.
              required: [full, clear, correct, partially, mouth, chin]
          required: [predominant_occlusion, estimations]
      example:
        mask:
          estimations:
            medical_mask: 0.7108324766
            missing: 0.0700698048
            occluded: 0.2190976739
          predominant_mask: "medical_mask"
          face_occlusion:
            predominant_occlusion: "correct"
            estimations:
              full: 0.1
              correct: 0.25
              clear: 0.05
              mouth: 0.2
              partially: 0.2
              chin: 0.2

    masks:
      allOf:
        - $ref: '#/components/schemas/masks_base'
      required: [estimations, predominant_mask, face_occlusion]

    masks_occlusion_not_required:
      allOf:
        - $ref: '#/components/schemas/masks_base'
        - required: [estimations, predominant_mask]

    glasses_estimations:
      type: string
      enum: [no_glasses, eyeglasses, sunglasses]
      description: Glasses estimation.

    glasses:
      type: object
      description: Estimated glasses.
      properties:
        glasses:
          $ref: '#/components/schemas/glasses_estimations'
      required: [glasses]

    liveness:
      type: object
      description: Liveness prediction.
      properties:
        prediction:
          type: string
          enum: [spoof, real, unknown]
          description: Liveness prediction name
        estimations:
          type: object
          description: Liveness estimations.
          properties:
            quality:
              allOf:
                - $ref: '#/components/schemas/number01'
              description: Liveness quality score. Support in backwards compatibility, always set to 1.
              deprecated: true
            score:
              allOf:
                - $ref: '#/components/schemas/number01'
              description: Liveness prediction score.
          required: [quality, score]
      required: [prediction, estimations]

    deepfake:
      type: object
      description: Deepfake prediction.
      properties:
        prediction:
          type: string
          enum: [ fake, real ]
          description: Deepfake prediction name
        score:
          allOf:
            - $ref: '#/components/schemas/number01'
          description: Deepfake prediction score.
      required: [ prediction, score ]

    image_binary_for_multipart:
      type: string
      format: binary
      description: |
        Binary image.

        Content-Disposition header must contain actual filename.

        Filenames are used to differentiate images, they must be unique within the request.

        This part must have valid Content-Type header (one of "image/jpeg", "image/png", "image/bmp", "image/tiff",
        "image/x-portable-pixmap")
        
        Trusted detections can be set by passing X-Luna-Trusted-Detections header (0 or 1).
        Note that enabling trusted detections with detections from external sources may affect estimations in an unexpected way.

    image_base64_for_multipart:
      type: string
      description: |
        Image encoded in base64.

        This part must have valid Content-Type header (one of "image/x-jpeg-base64", "image/x-png-base64",
        "image/x-bmp-base64", "image/x-tiff-base64", "image/x-portable-pixmap-base64")
        
        Trusted detections can be set by passing X-Luna-Trusted-Detections header (0 or 1).
        Note that enabling trusted detections with detections from external sources may affect estimations in an unexpected way.

    image_for_multipart:
      oneOf:
        - $ref: '#/components/schemas/image_binary_for_multipart'
        - $ref: '#/components/schemas/image_base64_for_multipart'

    image_list_for_multipart:
      type: array
      items:
        $ref: '#/components/schemas/image_for_multipart'
      minItems: 1

    raw_data_binary_for_multipart:
      type: string
      format: binary
      description: |
        Binary image or raw descriptor data (SDK descriptor or XPK file).

        Content-Disposition header must contain actual filename.

        Filenames are used to differentiate images, they must be unique within the request.

        This part must have valid Content-Type header (one of "image/jpeg", "image/png", "image/bmp", "image/tiff",
        "image/x-portable-pixmap", "application/x-sdk-descriptor", "application/x-vl-xpk")
        
        User-defined headers to be passed to the Luna Image Store when saving an image should be specified in the format
        `X-Luna-Meta-<user_defined_key>: <user_defined_value>` (will be skipped if the image origin is specified for the image).

        Trusted detections can be set by passing X-Luna-Trusted-Detections header (0 or 1).
        Note that enabling trusted detections with detections from external sources may affect estimations in an unexpected way.

    raw_data_base64_for_multipart:
      type: string
      description: |
        Image encoded in base64.

        This part must have valid Content-Type header (one of "image/x-jpeg-base64", "image/x-png-base64",
        "image/x-bmp-base64", "image/x-tiff-base64", "image/x-portable-pixmap-base64",
        "application/x-sdk-descriptor-base64", "application/x-vl-xpk-base64")
        
        User-defined headers to be passed to the Luna Image Store when saving an image should be specified in the format
        `X-Luna-Meta-<user_defined_key>: <user_defined_value>` (will be skipped if the image origin is specified for the image).

        Trusted detections can be set by passing X-Luna-Trusted-Detections header (0 or 1).
        Note that enabling trusted detections with detections from external sources may affect estimations in an unexpected way.

    raw_data_image_origin_for_multipart:
      type: string
      format: binary
      description: |
        Binary image.

        Content-Disposition header must contain actual filename.

        Filename is used to associate image origin with image, it must be the same as the image filename.

        This part must have valid Content-Type header (one of "image/jpeg", "image/png", "image/bmp", "image/tiff",
        "image/x-portable-pixmap")
        
        User-defined headers to be passed to the Luna Image Store when saving an image origin should be specified in the format `X-Luna-Meta-<user_defined_key>: <user_defined_value>`.


    raw_data_for_multipart:
      oneOf:
        - $ref: '#/components/schemas/raw_data_binary_for_multipart'
        - $ref: '#/components/schemas/raw_data_base64_for_multipart'

    raw_data_list_for_multipart:
      type: array
      items:
        $ref: '#/components/schemas/raw_data_for_multipart'
      minItems: 1

    image_detect_time:
      type: array
      description: Map with image filename and detection time.
      items:
        type: object
        properties:
          filename:
            type: string
            description: Image filename. It must be the same as one of 'image' request part filename.
          detect_time:
            $ref: "#/components/schemas/detect_time"
        required: [filename, detect_time]
      minItems: 1

    image_detect_ts:
      type: array
      description: Map with image filename and detection timestamp relative to the start of the video.
      items:
        type: object
        properties:
          filename:
            type: string
            description: Image filename. It must be the same as one of 'image' request part filename.
          detect_ts:
            allOf:
            - $ref: '#/components/schemas/detect_ts'
            nullable: false
        required: [filename, detect_ts]
      minItems: 1

    image_origin_list:
      type: array
      description: Map with image filename and image origin.
      items:
        oneOf:
          - $ref: '#/components/schemas/image_origin_list_item_json'
          - $ref: '#/components/schemas/raw_data_image_origin_for_multipart'
      minItems: 1

    verifier_detect_policy:
      type: object
      properties:
        multiface_policy:
          allOf:
            - description: |
                  Multiple face detection policy:
                  - *`0`* - multiple face detection not allowed
                  - *`1`* - multiple face detection allowed
                  - *`2`* - get best face detection from the image
            - $ref: '#/components/schemas/multiface_policy'
        estimate_head_pose:
          $ref: '#/components/schemas/estimate_head_pose'
        estimate_emotions:
          $ref: '#/components/schemas/estimate_emotions'
        estimate_mask:
          $ref: '#/components/schemas/estimate_mask'
        estimate_quality:
          $ref: '#/components/schemas/estimate_quality'
        estimate_gaze:
          $ref: '#/components/schemas/estimate_gaze'
        estimate_glasses:
          $ref: '#/components/schemas/estimate_glasses'
        estimate_eyes_attributes:
          $ref: '#/components/schemas/estimate_eyes_attributes'
        estimate_mouth_attributes:
          $ref: '#/components/schemas/estimate_mouth_attributes'
        detect_landmarks68:
          $ref: '#/components/schemas/detect_landmarks68'
        extract_exif:
          $ref: '#/components/schemas/extract_exif'
        yaw_threshold:
          allOf:
            - $ref: '#/components/schemas/yaw_threshold'
            - nullable: true
        roll_threshold:
          allOf:
            - $ref: '#/components/schemas/roll_threshold'
            - nullable: true
        pitch_threshold:
          allOf:
            - $ref: '#/components/schemas/pitch_threshold'
            - nullable: true
        mask_states:
          allOf:
            - $ref: '#/components/schemas/mask_states'
            - nullable: true
        estimate_liveness:
          $ref: '#/components/schemas/estimate_liveness'
        liveness_states:
          allOf:
            - $ref: '#/components/schemas/liveness_states'
            - nullable: true
        estimate_deepfake:
          $ref: '#/components/schemas/estimate_deepfake'
        deepfake_states:
          allOf:
            - $ref: '#/components/schemas/deepfake_states'
            - nullable: true
        face_quality:
          $ref: '#/components/schemas/face_quality'
        estimate_face_occlusion:
          $ref: '#/components/schemas/estimate_face_occlusion'
        face_occlusion_states:
          allOf:
            - $ref: '#/components/schemas/face_occlusion_states'
            - nullable: true

      description:  |
        Policy determinates parameters for face detection.

    verifier_detect_policy_required:
      allOf:
        - $ref: '#/components/schemas/verifier_detect_policy'
        - required: [multiface_policy, estimate_head_pose, estimate_emotions, estimate_mask, estimate_quality,
                     estimate_gaze, estimate_glasses, estimate_eyes_attributes, estimate_mouth_attributes, detect_landmarks68,
                     extract_exif, yaw_threshold, roll_threshold, pitch_threshold, mask_states, estimate_liveness,
                     liveness_states, estimate_deepfake, deepfake_states, face_quality, estimate_face_occlusion,
                     face_occlusion_states]

    verifier_extract_policy:
      type: object
      properties:
        extract_basic_attributes:
          $ref: '#/components/schemas/extract_basic_attributes'
        fd_score_threshold:
          $ref: '#/components/schemas/score_threshold'
      description: Policy determinates parameters for attributes extraction.

    verifier_extract_policy_required:
      allOf:
        - $ref: '#/components/schemas/verifier_extract_policy'
        - required: [extract_basic_attributes, fd_score_threshold]

    verifier_storage_policy:
      description: Verifier object's storing policy.
      type: object
      properties:
        attribute_policy:
          description: Attribute storing policy.
          type: object
          properties:
            store_attribute:
              allOf:
                - description: Whether to store attribute.
                - $ref: '#/components/schemas/int01_def0'
              default: 0
          example:
            store_attribute: 0
        face_sample_policy:
          description: Face sample storing policy.
          type: object
          properties:
            store_sample:
              allOf:
                - description: Whether to store face sample.
                - $ref: '#/components/schemas/int01_def0'
              default: 0
            ttl:
              $ref: '#/components/schemas/int_ttl'
          example:
            store_sample: 0
            ttl: 7

    verifier_storage_policy_required:
      $ref: '#/components/schemas/verifier_storage_policy'

    verification_threshold:
      allOf:
      - $ref: '#/components/schemas/number01'
      description: Verification similarity threshold.

    new_verifier:
      type: object
      properties:
        description:
          type: string
          maxLength: 128
          description: Verifier user description.
          example: strict verifier
        policies:
          type: object
          properties:
            verification_threshold:
              allOf:
                - $ref: '#/components/schemas/verification_threshold'
              default: 0.9
            detect_policy:
              $ref: '#/components/schemas/verifier_detect_policy'
            extract_policy:
              $ref: '#/components/schemas/verifier_extract_policy'
            storage_policy:
              $ref: '#/components/schemas/verifier_storage_policy'

    verifier_response:
      type: object
      properties:
        verifier_id:
          $ref: '#/components/schemas/handler_id'
        account_id:
          $ref: '#/components/schemas/account_id'
        description:
          type: string
          maxLength: 128
          description: User description.
        policies:
          type: object
          properties:
            verification_threshold:
              $ref: '#/components/schemas/verification_threshold'
            detect_policy:
              $ref: '#/components/schemas/verifier_detect_policy_required'
            extract_policy:
              $ref: '#/components/schemas/verifier_extract_policy_required'
            storage_policy:
              $ref: '#/components/schemas/verifier_storage_policy_required'
          required: [verification_threshold, detect_policy, extract_policy, storage_policy]
        create_time:
          type: string
          format: date-time
          description: The verifier creation time.
        last_update_time:
          type: string
          format: date-time
          description: The verifier last update time.
        version:
          description: Verifier current version (increases on update)
          type: integer
          minimum: 0
          example: 111
      required: [verifier_id, account_id, description, create_time, last_update_time, policies, version]

    raw_descriptor:
      type: string
      format: binary
      description: Raw descriptor.

    descriptor_data:
      type: object
      description: Descriptor and descriptor version.
      properties:
        descriptor:
          $ref: '#/components/schemas/raw_descriptor'
        version:
          $ref: '#/components/schemas/descriptor_version'
      required: [descriptor, version]

    descriptor_version:
      type: integer
      description: Face descriptor version.
      enum: [46, 52, 54, 56, 57, 58, 59, 60, 62, 64]
      example: 56

    body_descriptor_version:
      type: integer
      description: Body descriptor version.
      enum: [102, 103, 104, 105, 106, 107]
      example: 104

    xpk_file:
      type: string
      format: binary
      description: XPK file with descriptors.

    identification_id:
      allOf:
      - $ref: '#/components/schemas/common_id'
      - description: ID for identification in the match results.
      - example: 3456d

    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]

    raw_descriptor_entity_base64:
      allOf:
      - type: object
        properties:
          data:
            type: object
            properties:
              descriptor:
                type: string
                format: byte
      - $ref: '#/components/schemas/raw_descriptor_entity_binary'

    sdk_descriptor_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["sdk_descriptor"]
          description: Type corresponds to a `x-vl-face-descriptor` content type.
        data:
          $ref: '#/components/schemas/sdk_descriptor'
      required: [id, type, data]

    sdk_descriptor_entity_base64:
      allOf:
      - type: object
        properties:
          data:
            type: string
            format: byte
      - $ref: '#/components/schemas/sdk_descriptor_entity_binary'

    xpk_file_entity_binary:
      type: object
      properties:
        id:
          $ref: '#/components/schemas/identification_id'
        type:
          type: string
          enum: ["xpk_file"]
          description: Type corresponds to a `application/x-vl-xpk` content type.
        data:
          $ref: '#/components/schemas/xpk_file'
      required: [id, type, data]

    xpk_file_entity_base64:
      allOf:
      - type: object
        properties:
          data:
            type: string
            format: byte
      - $ref: '#/components/schemas/xpk_file_entity_binary'

    raw_verification_request_json:
      type: object
      properties:
        references:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/xpk_file_entity_base64'
              - $ref: '#/components/schemas/sdk_descriptor_entity_base64'
              - $ref: '#/components/schemas/raw_descriptor_entity_base64'
          description: Reference list for verification.
          minItems: 1
        candidates:
          type: array
          items:
            oneOf:
              - $ref: '#/components/schemas/xpk_file_entity_base64'
              - $ref: '#/components/schemas/sdk_descriptor_entity_base64'
              - $ref: '#/components/schemas/raw_descriptor_entity_base64'
          minItems: 1
          description: Candidates for verification.
      required: [references, candidates]

    raw_verification_request_msgpack:
      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 verification.
          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 verification.
      required: [references, candidates]

    raw_match_reference_id:
      allOf:
      - description: Reference ID for identification in the match results.
      - example: 123456s
      - $ref: '#/components/schemas/common_id'

    raw_match_candidate_id:
      allOf:
      - description: Candidate ID for identification in the match results.
      - example: 56789t
      - $ref: '#/components/schemas/common_id'

    raw_verification_response:
      type: object
      properties:
        matches:
          type: array
          items:
            type: object
            properties:
              reference_id:
                $ref: '#/components/schemas/raw_match_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:
                      $ref: '#/components/schemas/raw_match_candidate_id'
                    similarity:
                      $ref: '#/components/schemas/similarity'
                    status:
                      $ref: '#/components/schemas/verification_status'
                  required: [candidate_id, similarity, status]
                minItems: 1
                description: Reference vs candidates matches.
            required: [reference_id, matches]
          minItems: 1
          description: List of matches.
      required: [matches]

    verifier_base_verification:
      type: object
      properties:
        similarity:
          allOf:
          - $ref: '#/components/schemas/similarity'
          description: Similarity score.
        status:
          $ref: '#/components/schemas/verification_status'
          description: Verification result.
      required: [similarity, status]

    verifier_event_verification:
      allOf:
        - $ref: '#/components/schemas/verifier_base_verification'
        - type: object
          properties:
            event:
              type: object
              properties:
                event_id:
                  $ref: '#/components/schemas/event_id'
              description: Verification against an event ID.
              required: [event_id]
      required: [event]

    verifier_face_verification:
      allOf:
        - $ref: '#/components/schemas/verifier_base_verification'
        - type: object
          properties:
            face:
              type: object
              properties:
                face_id:
                  $ref: '#/components/schemas/face_id'
              description: Verification against a face.
              required: [face_id]
      required: [face]

    verifier_attribute_verification:
      allOf:
        - $ref: '#/components/schemas/verifier_base_verification'
        - type: object
          properties:
            attribute:
              type: object
              properties:
                attribute_id:
                  $ref: '#/components/schemas/attribute_id'
              description: Verification against an attribute.
              required: [ attribute_id ]
      required: [ attribute ]

    verifier_face_external_id_verification:
      allOf:
        - $ref: '#/components/schemas/verifier_base_verification'
        - type: object
          properties:
            face:
              type: object
              properties:
                external_id:
                  $ref: '#/components/schemas/face_external_id'
              description: Verification against a face.
              required: [ external_id ]
      required: [ similarity, status, face ]

    verifier_face_detection_face_attributes:
      type: object
      properties:
        attribute_id:
          nullable: true
          allOf:
            - $ref: '#/components/schemas/attribute_id'
          description: Attribute ID, null if descriptor score is lower than score threshold.
        basic_attributes:
          $ref: '#/components/schemas/basic_attributes'
        score:
          allOf:
          - $ref: '#/components/schemas/number01'
          description: Face descriptor quality score.
        url:
          nullable: true
          type: string
          format: uri-reference
          example: http://127.0.0.1:5030/3/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          description: Location of attributes, null if descriptor score is lower than score threshold.
        samples:
          type: array
          items:
            $ref: '#/components/schemas/sample_id'
          example: ['a3e8716f-70dc-42ad-8428-7a552e800a37']
          description: Resource for attributes.

      required: [attribute_id, url, samples]

    verifier_face_detection:
      type: object
      properties:
        verifications:
          type: array
          items:
            oneOf:
            - $ref: '#/components/schemas/verifier_face_verification'
            - $ref: '#/components/schemas/verifier_event_verification'
            - $ref: '#/components/schemas/verifier_face_external_id_verification'
            - $ref: '#/components/schemas/verifier_attribute_verification'

        face_attributes:
          $ref: '#/components/schemas/verifier_face_detection_face_attributes'

        sample:
          type: object
          nullable: true
          properties:
            face:
              allOf:
              - type: object
                properties:
                  rect:
                    allOf:
                    - $ref: '#/components/schemas/rect'
                    description: Face detection bounding box. Absent in case of verifying against warp.
                  sample_id:
                    $ref: '#/components/schemas/sample_id'
                  url:
                    type: string
                    nullable: true
                    format: uri-reference
                    example: http://127.0.0.1:5020/1/buckets/visionlabs-samples/images/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                    description: Location of the sample, null if sample was not stored.
              - $ref: '#/components/schemas/face_detection'
          required: [face]
      required: [verifications, face_attributes, sample]

    verifier_id_verification_response:
      type: object
      properties:
        images:
          description: Verification results for provided images/descriptors.
          type: array
          items:
            type: object
            description: Processed image.
            properties:
              error:
                allOf:
                  - $ref: '#/components/schemas/Error'
                  - example:
                      error_code: 0
                      detail: Success
                      desc: Success
                      link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0"
              status:
                allOf:
                  - $ref: '#/components/schemas/image_status'
                  - example: 1
                    description: |
                      Status 1 means that the image was processed without errors. Status 0 means
                      that the image was processed with errors, information about error is contained in field `error`

              filename:
                $ref: '#/components/schemas/filename'
              exif:
                $ref: '#/components/schemas/exif'
              detections:
                type: object
                description: Detections lists.
                properties:
                  face_detections:
                    type: array
                    items:
                      $ref: '#/components/schemas/verifier_face_detection'
                  filtered_detections:
                    $ref: '#/components/schemas/verifier_filtered_detections'
                required: [face_detections, filtered_detections]
            required: [error, status, filename, detections]
      required: [images]

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

    track_ids:
      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

    raw_event:
      type: object
      description: User generated events.
      properties:
        detections:
          description: List of body & face related detections.
          type: array
          maxItems: 100
          items:
            type: object
            description: User detected samples.
            properties:
              filename:
                default: ""
                allOf:
                - $ref: '#/components/schemas/filename'
              samples:
                type: object
                description: |
                  Body & face related samples that refer to the one person.
                properties:
                  body:
                    allOf:
                      - $ref: '#/components/schemas/input_event_body_detection_sample'
                      - nullable: true
                  face:
                    type: object
                    description: Face detection sample.
                    nullable: true
                    properties:
                      sample_id:
                        nullable: true
                        allOf:
                        - $ref: '#/components/schemas/sample_id'
                      detection:
                        type: object
                        description: Face detection.
                        properties:
                          attributes:
                            description: Face attributes estimation.
                            type: object
                            properties:
                              mouth_attributes:
                                allOf:
                                - $ref: '#/components/schemas/mouth_attributes'
                                - description: Optional mouth attributes.
                              eyes_attributes:
                                allOf:
                                - $ref: '#/components/schemas/eyes_attributes'
                                - description: Optional eye attributes.
                              emotions:
                                allOf:
                                - $ref: '#/components/schemas/emotions'
                                - description: Face emotions estimation.
                              mask:
                                $ref: '#/components/schemas/masks_occlusion_not_required'
                              head_pose:
                                allOf:
                                - $ref: '#/components/schemas/head_pose'
                                - description: Head pose estimation.
                              gaze:
                                allOf:
                                - $ref: '#/components/schemas/gaze_direction'
                                - description: Gaze direction estimation.
                              liveness:
                                $ref: '#/components/schemas/liveness'
                              deepfake:
                                $ref: '#/components/schemas/deepfake'
                              face_occlusion:
                                $ref: '#/components/schemas/face_occlusion'
                            example:
                              mouth_attributes:
                                occluded: 0.0
                                opened: 0.0
                                score: 1.0
                                smile: 0.0
                              emotions:
                                estimations:
                                  anger: 0.00894705578684807
                                  disgust: 0.00000965219624049496
                                  fear: 0.00121302821207792
                                  happiness: 0.00129503419157118
                                  neutral: 0.986027479171753
                                  sadness: 0.00187553185969591
                                  surprise: 0.000632198702078313
                                predominant_emotion: "neutral"
                              mask:
                                estimations:
                                  medical_mask: 0.7108324766
                                  missing: 0.0700698048
                                  occluded: 0.2190976739
                                predominant_mask: medical_mask
                                face_occlusion:
                                  predominant_occlusion: "correct"
                                  estimations:
                                    full: 0.1
                                    correct: 0.25
                                    clear: 0.05
                                    mouth: 0.2
                                    partially: 0.2
                                    chin: 0.2
                              head_pose:
                                pitch: 18.6827487945557
                                roll: -10.3542232513428
                                yaw: 15.4102487564087
                              gaze:
                                pitch: 9.26744079589844
                                yaw: -19.4657287597656
                              liveness:
                                prediction: "spoof"
                                estimations:
                                  score: 0.5108324766
                                  quality: 1
                              deepfake:
                                prediction: "real"
                                score: 0.5108324766
                              face_occlusion:
                                prediction: 0
                                estimations:
                                  overall_score: 0.01
                                  hair_score: 0.02
                                  lower_face_score: 0.012
                                  nose_score: 0.002
                                  mouth_score: 0.003
                                  forehead_score: 0.012
                                  left_eye_score: 0.032
                                  right_eye_score: 0.021
                                face_occlusion:
                                  lower_face_occluded: 0
                                  mouth_occluded: 0
                                  nose_occluded: 0
                                  left_eye_occluded: 0
                                  right_eye_occluded: 0
                                  forehead_occluded: 0
                          quality:
                            allOf:
                            - $ref: '#/components/schemas/quality'
                            - description: Image quality estimation for this face detection region.
                          rect:
                            allOf:
                            - $ref: '#/components/schemas/rect'
                            - description: Face detection bounding box.
                          landmarks5:
                            allOf:
                            - $ref: '#/components/schemas/landmarks5'
                            - description: Facial landmarks.
                          landmarks68:
                            allOf:
                            - $ref: '#/components/schemas/landmarks68'
                            - description: Facial landmarks.
                          face_quality:
                            allOf:
                            - $ref: '#/components/schemas/face_quality_checks_estimations'
                            description: Face quality checks estimations.
                      url:
                        description: |
                          User saved face sample location. If user does not set it and sample id is not null it will.
                          be generated automatically.
                        example:
                          http://127.0.0.1:5020/2/buckets/123/images/45838c8b-04a1-4230-bda0-b5f77609b695
                        allOf:
                          - $ref: '#/components/schemas/input_url'
                    required:
                    - detection
                    - sample_id
              detect_time:
                $ref: "#/components/schemas/detect_time"
              detect_ts:
                $ref: "#/components/schemas/detect_ts"
              image_origin:
                $ref: "#/components/schemas/image_origin"

            required: [samples]
        source:
          $ref: '#/components/schemas/source'
        stream_id:
          $ref: '#/components/schemas/stream_id'
        location:
          $ref: '#/components/schemas/input_location'
        external_id:
          $ref: '#/components/schemas/event_external_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        track_id:
          $ref: '#/components/schemas/track_id'
        meta:
          $ref: "#/components/schemas/event_meta_common"
        face:
          $ref: '#/components/schemas/input_event_face'
        matches:
          allOf:
            - maxItems: 30
            - $ref: '#/components/schemas/matches'
        face_attributes:
          $ref: '#/components/schemas/input_event_face_attribute'
        body_attributes:
          $ref: '#/components/schemas/input_event_body_attribute'
        aggregate_estimations:
          $ref: '#/components/schemas/EventAggregateEstimations_masks_occlusion_not_required'
        tags:
          allOf:
          - $ref: '#/components/schemas/tags'
          - maxItems: 100
        create_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: Time of the event creation.
        end_time:
          allOf:
            - $ref: "#/components/schemas/time"
            - description: The end time of the event.
      example:
        create_time: 2018-08-11T09:11:41.674Z
        end_time: 2018-08-11T10:10:40.555Z
        face_attributes:
          attribute_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
          basic_attributes:
            age: 29
            gender: 1
            ethnicities:
              estimations:
                african_american: 1.92238889737406e-12
                asian: 0.954671621322632
                caucasian: 0.045328326523304
                indian: 7.65100649502415e-10
              predominant_ethnicity: asian
          descriptor: string
          score: 0.7525901794
          url: /6/attributes/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
          samples:
            - a3e8716f-70dc-42ad-8428-7a552e800a37
        body_attributes:
          score: 0
          samples:
              - a3e8716f-70dc-42ad-8428-7a552e800a37
          descriptor: string
        source: 3rd Avenue
        stream_id: a3e8716f-70dc-42ad-8428-7a552e800a37
        tags:
          - tag1
          - tag2
        external_id: b668c4a5-2191-some-important-words
        user_data: string
        meta:
          key: value
        face:
          face_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c6
          event_id: f9687459-986b-406d-9c1f-0d6289be5256
          user_data: fox1991
          external_id: 2xQ2gprbMUePw1s9gw9fvA==
          avatar: /6/samples/faces/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
          lists:
            - 429b0e78-4616-426a-b57f-02baa72d638d
            - 6d037c33-31ec-4d73-b3b3-ec80b09446c2
          url: /6/faces/24d405ce-bc56-4bf7-98e1-bdc962b4cf34
        matches:
          - label: good guys
            candidates:
              - face:
                  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: /6/samples/faces/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
                  event_id: f9687459-986b-406d-9c1f-0d6289be5256
                similarity: 0.5
          - label: bad guys
            candidates:
              - event:
                  event_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                  external_id: 2xQ2gprbMUePw1s9gw9fvA==
                  user_data: fox1991
                  create_time: 2018-08-11T09:11:41.674Z
                  handler_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                  source: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                  stream_id: 426542d6-5509-4e5b-8a01-e2abd5c0a8c7
                similarity: 0.3
        location:
          city: Moscow
          area: ZAO
          district: Arbat
          street: Arbat
          house_number: "10"
          geo_position:
            longitude: 36.616
            latitude: 55.752
        detections:
          - filename: penelope.jpeg
            samples:
              body:
                sample_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                detection:
                  rect:
                    height: 240
                    width: 209
                    x: 170
                    y: 198
                url: /6/samples/bodies/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
              face:
                sample_id: b668c4a5-2191-476e-a261-3b4f9ce2e25e
                detection:
                  attributes:
                    mouth_attributes:
                      occluded: 0
                      opened: 0
                      score: 1
                      smile: 0
                    emotions:
                      estimations:
                        anger: 0.00894705578684807
                        disgust: 9.65219624049496e-06
                        fear: 0.00121302821207792
                        happiness: 0.00129503419157118
                        neutral: 0.986027479171753
                        sadness: 0.00187553185969591
                        surprise: 0.000632198702078313
                      predominant_emotion: neutral
                    mask:
                      estimations:
                        medical_mask: 0.7108324766
                        missing: 0.0700698048
                        occluded: 0.2190976739
                      predominant_mask: medical_mask
                      face_occlusion:
                        predominant_occlusion: "correct"
                        estimations:
                          full: 0.1
                          correct: 0.25
                          clear: 0.05
                          mouth: 0.2
                          partially: 0.2
                          chin: 0.2
                    head_pose:
                      pitch: 18.6827487945557
                      roll: -10.3542232513428
                      yaw: 15.4102487564087
                    gaze:
                      pitch: 9.26744079589844
                      yaw: -19.4657287597656
                    liveness:
                      prediction: spoof
                      estimations:
                        quality: 1
                        score: 0.9345
                    deepfake:
                      prediction: real
                      score: 0.9345
                  quality:
                    light: 0.87
                    dark: 0.13
                    illumination: 0.1
                    specularity: 0.1
                    blurriness: 0.2
                  rect:
                    height: 240
                    width: 209
                    x: 170
                    y: 198
                url: /6/samples/faces/a16c8b6c-2818-4bae-9fd5-65acc8d4bb5c
            detect_time: 2018-08-11T09:11:41.674Z
            detect_ts: 123
            image_origin: /6/images/b668c4a5-2191-476e-a261-3b4f9ce2e25e
        track_id: useful_track_id_number_1
        aggregate_estimations:
          face:
            attributes:
              liveness:
                prediction: spoof
                estimations:
                  quality: 1
                  score: 0.9345
              deepfake:
                prediction: real
                score: 0.9345
          body:
            attributes:
              basic_attributes:
                apparent_age: 0
                apparent_gender: 0
              upper_body:
                headwear:
                  state: 0
                  apparent_color: "black"
                sleeve:
                  length: "short"
                upper_clothing:
                  colors: ["white", "black"]
              lower_body:
                shoes:
                  apparent_color: "white"
                lower_garment:
                  colors: [ "white", "black" ]
                  type: "trousers"
              accessories:
                backpack:
                  state: 0

    saved_event:
      type: object
      properties:
        event_id:
          $ref: '#/components/schemas/event_id'
        url:
          type: string
          format: uri-reference
      required:
        - event_id
        - url
      example:
        event_id: b5d6fd45-fcca-453d-ac05-3e594054b813
        url: http://127.0.0.1:5040/2/events/b5d6fd45-fcca-453d-ac05-3e594054b813

    samples:
      type: array
      items:
        $ref: '#/components/schemas/uuid'
      maxItems: 8
      minItems: 1

    face_attribute_upgrade_policy:
      type: object
      description: Face attribute upgrade policy.
      properties:
        fd_score_threshold:
          $ref: '#/components/schemas/score_threshold'
        extract_descriptor:
          allOf:
          - $ref: '#/components/schemas/extract_descriptor'
          - default: 1
        extract_basic_attributes:
          $ref: '#/components/schemas/extract_basic_attributes'
        descriptor_version:
          allOf:
          - $ref: '#/components/schemas/descriptor_version'
          default: 62
          description: |
              Face descriptor version. Default descriptor version from config is used if not specified.
              Used only if *extract_descriptor* equal *1*.

    body_attribute_upgrade_policy:
      type: object
      description: |
          Body attribute upgrade policy. It is possible only to upgrade descriptor, so
          body descriptor extraction is mandatory and will be done for each specified body sample
      properties:
        descriptor_version:
          allOf:
          - $ref: '#/components/schemas/body_descriptor_version'
          default: 104
          description: Body descriptor version. Default descriptor version from config is used if not specified.

    face_upgrade_data:
      type: object
      description: Face samples and its upgrade rules.
      properties:
        samples:
          allOf:
            - $ref: '#/components/schemas/samples'
            - description: Face sample ID list.
        policy:
          $ref: '#/components/schemas/face_attribute_upgrade_policy'
      required: [samples]

    body_upgrade_data:
      type: object
      description: body samples and its upgrade rules
      properties:
        samples:
          allOf:
            - $ref: '#/components/schemas/samples'
            - description: body sample id list
        policy:
          $ref: '#/components/schemas/body_attribute_upgrade_policy'
      required: [samples]

    upgrade_face_attribute:
      type: object
      properties:
        face_id:
          $ref: '#/components/schemas/face_id'
        upgrade_data:
          $ref: '#/components/schemas/face_upgrade_data'
      required: [face_id, upgrade_data]

    upgrade_event_attribute:
      type: object
      properties:
        event_id:
          $ref: '#/components/schemas/event_id'
        face_upgrade_data:
          $ref: '#/components/schemas/face_upgrade_data'
        body_upgrade_data:
          $ref: '#/components/schemas/body_upgrade_data'
      required: [event_id]

    upgrade_attribute_schema:
      oneOf:
        - $ref: '#/components/schemas/upgrade_face_attribute'
        - $ref: '#/components/schemas/upgrade_event_attribute'

    health_ok:
      description: Successful healthcheck execution info.
      type: object
      properties:
        execution_time:
          type: number
          example: 0.123
          description: Request execution time in seconds.
      required: [execution_time]

    health_errors:
      type: object
      properties:
        errors:
          description: Failed healthcheck execution info.
          type: array
          items:
            type: object
            properties:
              component:
                description: Component name.
                type: string
              error:
                allOf:
                  - description: Healthcheck error.
                  - $ref: '#/components/schemas/Error'
              status:
                description: Component health status.
                type: integer
                enum: [0, 1]
            required: [component, error, status]
      required: [errors]
      example:
        errors:
          - component: handlers_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
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0"
            status: 1
          - component: events
            error:
              error_code: 0
              desc: Success
              detail: Success
              link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-0"
            status: 1

    face_check_name:
      type: string
      description: Unique estimation name.

    face_check_result:
      type: integer
      enum: [ 0, 1 ]
      description: Check result (1 - succeeded, 0 - failed).

    face_object_value_score:
      type: number
      format: double
      minimum: 0
      maximum: 1
      nullable: true
      description: Estimated value as a number.
      example: 0.15675428

    face_object_value_number:
      type: number
      format: double
      nullable: true
      description: Estimated value as a number.
      example: 0.15675428

    face_object_value_int_positive:
      type: integer
      minimum: 0
      nullable: true
      description: Estimated value as an integer.
      example: 1

    iso_object_value_string:
      type: string
      nullable: true
      description: Estimated value as a string.

    face_threshold_value_int_positive:
      type: object
      properties:
        min:
          type: integer
          minimum: 0
          nullable: true
          description: Lower bound of the allowed range.
          example: 0
        max:
          type: integer
          minimum: 0
          nullable: true
          description: Upper bound of the allowed range.
          example: 1
      required: [ min, max ]
      description: Allowed range of the estimation value.

    face_threshold_value_int_positive_max_nullable:
      type: object
      properties:
        min:
          type: integer
          minimum: 0
          description: Lower bound of the allowed range.
          example: 0
        max:
          type: integer
          minimum: 0
          nullable: true
          description: Upper bound of the allowed range.
          example: 1
      required: [ min, max ]
      description: Allowed range of the estimation value.

    face_threshold_value_number:
      type: object
      properties:
        min:
          type: number
          nullable: true
          description: Lower bound of the allowed range.
          example: 0
        max:
          type: number
          nullable: true
          description: Upper bound of the allowed range.
          example: 1
      required: [ min, max ]
      description: Allowed range of the estimation value.

    check_eye_distance_threshold_value_number:
      type: object
      properties:
        min:
          type: number
          description: Lower bound of the allowed range.
          example: 0
        max:
          type: number
          nullable: true
          description: Upper bound of the allowed range.
          example: 1
      required: [ min, max ]
      description: Allowed range of the estimation value.

    face_check_element_number:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/face_check_name'
        object_value:
          $ref: '#/components/schemas/face_object_value_number'
        threshold_value:
          $ref: '#/components/schemas/face_threshold_value_number'
        result:
          $ref: '#/components/schemas/face_check_result'
      required: [ name, object_value, threshold_value, result ]

    check_eye_distance_element_number:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/face_check_name'
        object_value:
          $ref: '#/components/schemas/face_object_value_number'
        threshold_value:
          $ref: '#/components/schemas/check_eye_distance_threshold_value_number'
        result:
          $ref: '#/components/schemas/face_check_result'
      required: [ name, object_value, threshold_value, result ]

    image_check_element_int_positive:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/face_check_name'
        object_value:
          $ref: '#/components/schemas/face_object_value_int_positive'
        threshold_value:
          $ref: '#/components/schemas/face_threshold_value_int_positive'
        result:
          $ref: '#/components/schemas/face_check_result'
      required: [ name, object_value, threshold_value, result ]

    face_check_element_int_positive:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/face_check_name'
        object_value:
          $ref: '#/components/schemas/face_object_value_int_positive'
        threshold_value:
          $ref: '#/components/schemas/face_threshold_value_int_positive_max_nullable'
        result:
          $ref: '#/components/schemas/face_check_result'
      required: [ name, object_value, threshold_value, result ]

    face_check_element_score:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/face_check_name'
        object_value:
          $ref: '#/components/schemas/face_object_value_score'
        threshold_value:
          $ref: '#/components/schemas/face_threshold_value_number'
        result:
          $ref: '#/components/schemas/face_check_result'
      required: [ name, object_value, threshold_value, result ]

    face_check_element_string:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/face_check_name'
        object_value:
          $ref: '#/components/schemas/iso_object_value_string'
        threshold_value:
          type: array
          items:
            type: string
          description: List of estimation values allowed.
        result:
          $ref: '#/components/schemas/face_check_result'
      required: [ name, object_value, threshold_value, result ]

    check_result:
      type: integer
      enum: [ 0, 1 ]
      description: Check result (1 - succeeded, 0 - failed).

    check_image_format:
      type: object
      properties:
        name:
          type: string
          enum: [ image_format ]
          description: Unique estimation name.
        object_value:
          type: string
          enum: [ JPEG, JPEG2000, PNG, BMP, TIFF, Portable pixmap ]
          nullable: true
          description: Original image format.
          example: JPEG
        threshold_value:
          $ref: '#/components/schemas/image_format_threshold'
        result:
          $ref: '#/components/schemas/check_result'
      required: [ name, object_value, threshold_value, result ]
      description: Checking the image format for compliance with the standard.

    check_image_quality:
      allOf:
        - $ref: '#/components/schemas/face_check_element_score'
        - properties:
            name:
              enum: [ blurriness_quality, specularity_quality, illumination_quality, dark_quality, light_quality ]
        - description: Checking the image quality.

    check_glasses_state:
      allOf:
        - $ref: '#/components/schemas/face_check_element_string'
        - properties:
            name:
              enum: [ glasses ]
            object_value:
              type: string
              enum: [ no_glasses, eyeglasses, sunglasses ]
              example: eyeglasses
        - description: Checking eyes state.

    check_eyes_state:
      allOf:
        - $ref: '#/components/schemas/face_check_element_string'
        - properties:
            name:
              enum: [ left_eye, right_eye ]
            object_value:
              type: string
              enum: [ open, occluded, closed ]
              example: occluded
        - description: Checking eyes state.

    check_gaze_direction:
      allOf:
        - $ref: '#/components/schemas/face_check_element_number'
        - properties:
            name:
              enum: [ gaze_pitch, gaze_yaw ]
        - description: Checking the gaze direction angles.

    check_mouth_state:
      allOf:
        - $ref: '#/components/schemas/face_check_element_score'
        - properties:
            name:
              enum: [ mouth_open, mouth_smiling, mouth_occluded ]
        - description: Checking the mouth state.

    check_head_rotation:
      allOf:
        - $ref: '#/components/schemas/face_check_element_number'
        - properties:
            name:
              enum: [ head_pitch, head_roll, head_yaw ]
        - description: Checking the head rotation angles.

    check_head_position:
      allOf:
        - $ref: '#/components/schemas/face_check_element_number'
        - properties:
            name:
              enum: [ head_horizontal_center, head_vertical_center ]
        - description: Checking the head position is normally centered in relation to the original image.

    check_head_proportions:
      allOf:
        - $ref: '#/components/schemas/face_check_element_number'
        - properties:
            name:
              enum: [ head_width, head_height ]
        - description: Checking the head width & height are normal in relation to the size of the image.

    check_eye_distance:
      allOf:
        - $ref: '#/components/schemas/check_eye_distance_element_number'
        - properties:
            name:
              enum: [ eye_distance ]
        - description: Checking the distance between the eyes is sufficient.

    check_image_properties:
      allOf:
        - $ref: '#/components/schemas/image_check_element_int_positive'
        - properties:
            name:
              enum: [ image_width, image_height, image_size ]
        - description: Checking the image width & height (in pixels) and the image size (in bytes).

    check_aspect_ratio:
      allOf:
        - $ref: '#/components/schemas/face_check_element_number'
        - properties:
            name:
              enum: [ aspect_ratio ]
        - description: Checking the image width to height aspect ratio.

    check_face_properties:
      allOf:
        - $ref: '#/components/schemas/face_check_element_int_positive'
        - properties:
            name:
              enum: [ face_width, face_height, indent_left, indent_right, indent_upper, indent_lower ]
        - description: Checking the face width, height and horizontal and vertical indents (in pixels).

    check_face_illumination_uniformity:
      allOf:
        - $ref: '#/components/schemas/face_check_element_score'
        - properties:
            name:
              enum: [ illumination_uniformity, dynamic_range ]
        - description: Checking the face uniformity and dynamic illumination.

    image_type:
      type: integer
      default: 0
      enum: [ 0,1,2 ]
      description: Image type of input image.  0 - raw image, 1 - face warped image, 2 - body warped image.

    use_exif_info:
      type: integer
      enum: [0, 1]
      default: 1
      description: |
        Whether to try to auto orient image based on exif data

        *Has no effect with tiff images (they're always auto oriented).*

        *Ignored with warped images (see `warped_image` or `image_type` parameter).*
      example: 1

    source_data:
      type: object
      description: event source data
      properties:
        event_end_time:
          allOf:
          - $ref: "#/components/schemas/time"
          description: luna event end time
        event_time:
          allOf:
          - $ref: '#/components/schemas/time'
          description: luna event time
        external_id:
          $ref: '#/components/schemas/event_external_id'
        meta:
          $ref: '#/components/schemas/event_meta_common'
        source:
          $ref: '#/components/schemas/source'
        stream_id:
          $ref: '#/components/schemas/stream_id'
        tags:
          $ref: '#/components/schemas/tags'
        track_id:
          $ref: '#/components/schemas/track_id'
        user_data:
          $ref: '#/components/schemas/event_user_data'
        location:
          $ref: '#/components/schemas/location'

    event_source_body_meta:
      allOf:
        - $ref: '#/components/schemas/image_meta'
      description: |
        Image meta
        
        Will be used as User-defined headers (`X-Luna-Meta-*`) to be passed to the Luna Image Store when saving an 
        image origin; should be specified in the format `X-Luna-Meta-<user_defined_key>: <user_defined_value>`
        (will be skipped if the image origin is not specified).
        
        All keys which don't match the `X-Luna-Meta-*` pattern will be ignored

    image_origin_msgpack:
      properties:
        body:
          description: Raw image in bytes.
          type: bytes
        meta:
          $ref: '#/components/schemas/event_source_body_meta'
      required:
      - body
      type: object

    image_meta:
      type: object
      properties:
        X-Luna-Meta-*:
          type: string
          description: meta information
      required: X-Luna-Meta-*

    source_type:
      type: string
      description: |
        source type
        
        `raw_image` - for each raw image will be executed detection taking into account indicated face/body bounding boxes
        
        `detections` - user detected on image objects with specified data

        Note for *detection* source type in the case of `image_origin` not specified: during *image-origin-policy* 
        processing it will use the same logic as for *generate events* request with several exceptions:
        
        - if face or body warp specified, it will be saved as image origin
        
        - if both warps specified, face warp will become the image origin

      enum: [ raw_image, detections ]

    event_source_base:
      type: object
      properties:
        detect_time:
          $ref: '#/components/schemas/detect_time'
        detect_ts:
          $ref: '#/components/schemas/detect_ts'
        filename:
          description: Image filename.
          type: string
        image_origin:
          oneOf:
          - $ref: '#/components/schemas/image_origin_msgpack'
          - $ref: '#/components/schemas/image_origin'
          description: image origin

    event_sources_base:
      type: object
      properties:
        aggregate_attributes:
          $ref: '#/components/schemas/aggregate_attributes'
        use_exif_info:
          $ref: '#/components/schemas/use_exif_info'
      required:
      - sources
      - aggregate_attributes

    event_source_raw_image_base:
      type: object
      description: raw image
      properties:
        body:
          description: Image in bytes.
          type: bytes
        meta:
          $ref: '#/components/schemas/event_source_body_meta'
        face_detection_data:
          $ref: '#/components/schemas/face_detection_data'
        body_detection_data:
          $ref: '#/components/schemas/body_detection_data'
        trusted_detections:
          $ref: '#/components/schemas/trusted_detections'
      required: [ body ]


    body_detection_data:
      type: array
      description: Body detection data
      items:
        type: object
        additionalProperties:
          x-additionalPropertiesName: body detection additional fields
          description: any `key=value` pairs
        properties:
          bounding_box:
            $ref: '#/components/schemas/rect'
          origin_bounding_box:
            allOf:
              - description: Bounding rectangle to save as detection result
              - $ref: '#/components/schemas/rect'
        required: [bounding_box]

    face_detection_data:
      type: array
      description: Face detection data
      items:
        type: object
        additionalProperties:
          x-additionalPropertiesName: face detection additional fields
          description: any `key=value` pairs
        properties:
          bounding_box:
            $ref: '#/components/schemas/rect'
          origin_bounding_box:
            allOf:
              - description: Bounding rectangle to save as detection result
              - $ref: '#/components/schemas/rect'
          angles:
            $ref: '#/components/schemas/angles'
          score:
            $ref: '#/components/schemas/score'
        required: [bounding_box]

    score:
      type: float
      description: score
      minimum: 0
      maximum: 1

    angles:
      type: object
      description: angles
      properties:
        pitch:
          allOf:
            - $ref: "#/components/schemas/angle"
          description: pitch
        roll:
          allOf:
            - $ref: "#/components/schemas/angle"
          description: roll
        yaw:
          allOf:
            - $ref: "#/components/schemas/angle"
          description: yaw
      required: [ pitch, roll, yaw ]

    event_source_detection_part:
      type: object
      properties:
        warp:
          type: bytes
          description: raw warp
        meta:
          $ref: '#/components/schemas/event_source_body_meta'
        origin_bounding_box:
          $ref: '#/components/schemas/rect'

    event_source_detection:
      type: object
      description: event source detection
      properties:
        face:
          allOf:
            - $ref: '#/components/schemas/event_source_detection_part'
          additionalProperties:
            x-additionalPropertiesName: face additional fields
            description: any `key=value` pairs
          properties:
            angles:
              $ref: '#/components/schemas/angles'
            score:
              $ref: '#/components/schemas/score'
          description: face detection
        body:
          allOf:
            - $ref: '#/components/schemas/event_source_detection_part'
          description: body detection

    event_source_detections:
      type: array
      items:
        $ref: '#/components/schemas/event_source_detection'

    source_raw_image:
      type: object
      properties:
        source_type:
          $ref: '#/components/schemas/source_type'
        source:
          $ref: '#/components/schemas/event_source_raw_image_base'

    source_raw_image_with_source_data:
      type: object
      properties:
        source_type:
          $ref: '#/components/schemas/source_type'
        source:
          allOf:
            - $ref: '#/components/schemas/event_source_raw_image_base'
          properties:
            source_data:
              $ref: '#/components/schemas/source_data'

    source_detections:
      type: object
      properties:
        source_type:
          $ref: '#/components/schemas/source_type'
        source:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/event_source_detection'
          description: Detections.

    source_detections_with_source_data:
      type: object
      properties:
        source_type:
          $ref: '#/components/schemas/source_type'
        source:
          type: array
          items:
            allOf:
              - $ref: '#/components/schemas/event_source_detection'
            properties:
              source_data:
                $ref: '#/components/schemas/source_data'
          description: Detections.

    event_source_raw_image_aggregated:
      allOf:
        - $ref: '#/components/schemas/source_raw_image'
        - $ref: '#/components/schemas/event_source_base'
      additionalProperties:
        x-additionalPropertiesName: source additional fields
        description: any `key=value` pairs
      required: [ source, source_type ]

    event_source_raw_image_non_aggregated:
      allOf:
        - $ref: '#/components/schemas/source_raw_image_with_source_data'
        - $ref: '#/components/schemas/event_source_raw_image_aggregated'
      additionalProperties:
        x-additionalPropertiesName: source additional fields
        description: any `key=value` pairs

    event_source_detections_aggregated:
      type: object
      allOf:
        - $ref: '#/components/schemas/source_detections'
        - $ref: '#/components/schemas/event_source_base'
      additionalProperties:
        x-additionalPropertiesName: source additional fields
        description: any `key=value` pairs
      required: [ source, source_type ]

    event_source_detections_non_aggregated:
      allOf:
        - $ref: '#/components/schemas/source_detections_with_source_data'
        - $ref: '#/components/schemas/event_source_detections_aggregated'

    event_sources_non_aggregated:
      oneOf:
        - $ref: '#/components/schemas/event_source_raw_image_non_aggregated'
        - $ref: '#/components/schemas/event_source_detections_non_aggregated'
      discriminator:
        propertyName: source_type
        mapping:
          raw_image: '#/components/schemas/event_source_raw_image_non_aggregated'
          detections: '#/components/schemas/event_source_detections_non_aggregated'

    event_sources_aggregated:
      oneOf:
        - $ref: '#/components/schemas/event_source_raw_image_aggregated'
        - $ref: '#/components/schemas/event_source_detections_aggregated'
      discriminator:
        propertyName: source_type
        mapping:
          raw_image: '#/components/schemas/event_source_raw_image_aggregated'
          detections: '#/components/schemas/event_source_detections_aggregated'

    non_aggregated_event_sources:
      allOf:
        - $ref: '#/components/schemas/event_sources_base'
      properties:
        aggregate_attributes:
          allOf:
            - $ref: '#/components/schemas/aggregate_attributes'
          enum: [0]
        sources:
          items:
            $ref: '#/components/schemas/event_sources_non_aggregated'
          minItems: 1
          type: array

    aggregated_event_sources:
      allOf:
        - $ref: '#/components/schemas/event_sources_base'
      properties:
        aggregate_attributes:
          allOf:
            - $ref: '#/components/schemas/aggregate_attributes'
          enum: [1]
        source_data:
          $ref: '#/components/schemas/source_data'
        sources:
          items:
            $ref: '#/components/schemas/event_sources_aggregated'
          minItems: 1
          type: array

    stream_event_request_body:
      oneOf:
      - $ref: '#/components/schemas/non_aggregated_event_sources'
      - $ref: '#/components/schemas/aggregated_event_sources'
      discriminator:
        propertyName: aggregate_attributes
        mapping:
          0: '#/components/schemas/non_aggregated_event_sources'
          1: '#/components/schemas/aggregated_event_sources'

    plugin_status:
      type: object
      properties:
        name:
          type: string
          description: Plugin name
        running:
          allOf:
            - $ref: '#/components/schemas/int01'
            - 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'

    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:5090/{...}, method {...}
              link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-9"

    verifier_not_found:
      description: Verifier not found.
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 34004
            desc: Object not found
            detail: Verifier with ID '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
            link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-34004"

    handler_not_found:
      description: Handler not found.
      headers:
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
        Content-Type:
          $ref: '#/components/headers/application_json'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          example:
            error_code: 11033
            desc: Object not found
            detail: Handler with ID '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
            link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11033"

    image_not_found:
      description: Image not found.
      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:
            sample_not_found:
              value:
                error_code: 13003
                desc: Object not found
                detail: Image with ID '7acc35cf-a3b2-4f87-8d8b-5496a2782d37' not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-13003"

    one_detection_rect_per_image:
      description: Only one detection rect for each image available.
      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:
            one_rect_per_image:
              value:
                error_code: 11045
                desc: Forbidden
                detail: Only one detection rect for each image available at the moment
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11045"

    lis_disabled:
      description: The luna-image-store is disabled.
      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: 11070
            desc: Forbidden
            detail: Luna Image Store service is disabled
            link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11070"

    generate_events_bad_input_data:
      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_query:
              value:
                error_code: 12012
                desc: "Bad/incomplete input data"
                detail: "Bad query parameters 'estimate_eyes_attributes'"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
            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_content_type_download_image:
              value:
                error_code: 11028
                desc: Bad/incomplete input data
                detail: 'Bad content type of image ''https://www.google.ru'''
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11028"
            bad_content_type_multipart:
              value:
                error_code: 11029
                desc: Bad/incomplete input data
                detail: Bad content type of image in multipart body
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11029"
            bad_multipart_input:
              value:
                error_code: 11027
                desc: Bad/incomplete input data
                detail: 'Not available to send new policies to non-dynamic handler'
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027"
            bad_input_data:
              value:
                error_code: 11027
                desc: Bad/incomplete input data
                detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'List should have at most 30 items after validation, not 31'"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027"
            missing_image:
              value:
                error_code: 11049
                desc: Bad/incomplete input data
                detail: |
                  Required field 'image' not found in request
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11049"
            unsupported_descriptor_version:
              value:
                error_code: 34001
                desc: Forbidden
                detail: Descriptor version 42 is not supported
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-34001"
            bad_sdk_descriptor:
              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"
            bad_xpk:
              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"
            aggregation_not_supported:
              value:
                error_code: 34003
                desc: Bad/incomplete input data
                detail: Aggregation is not supported for raw descriptors
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-34003"
            account_id_not_found:
              value:
                error_code: 11066
                desc: Bad/incomplete input data
                detail: Luna-Account-Id header not found
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
            bad_account_id:
              value:
                error_code: 11037
                desc: Bad/incomplete input data
                detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"

    generate_events_access_errors:
      description: Access to this resource on the server is denied
      headers:
        Content-Type:
          $ref: '#/components/headers/application_json'
        Luna-Request-Id:
          $ref: '#/components/headers/luna_request_id'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
          examples:
            events_is_disabled:
              value:
                error_code: 11040
                desc: Forbidden
                detail: Luna Events service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11040"
            lis_is_disabled:
              value:
                error_code: 11070
                desc: Forbidden
                detail: Luna Image Store service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11070"
            sender_is_disabled:
              value:
                error_code: 35001
                desc: Forbidden
                detail: Luna Sender service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11070"
            one_rect_available:
              value:
                error_code: 11045
                desc: Forbidden
                detail: Only one detection rect for each image available at the moment
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11045"
            fsdk_liveness_disabled:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: Liveness v.2 feature disabled"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
            liveness_disabled:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: Liveness feature disabled"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
            deepfake_disabled:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: Deepfake feature disabled"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
            licence_expired:
              value:
                error_code: 11055
                desc: Forbidden
                detail: "License problem: License expired"
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
            lambda_is_disabled:
              value:
                error_code: 11071
                desc: Forbidden
                detail: Luna Lambda service is disabled
                link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11071"

    lambda_disabled:
      description: The luna-lambda is disabled.
      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: 11071
            desc: Forbidden
            detail: Luna Lambda service is disabled
            link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11071"

    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 version of service.
      operationId: getVersion

      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/version'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/detector:
    post:
      tags: [samples]
      summary: detect faces
      description: |
        Detect faces in input images.

        Notes for incoming data:
          - face or body *bounding boxes* passed with face or body wapred image will be ignored.

      operationId: detectFaces
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - in: header
        name: Content-Type

        schema:
          type: string
          enum:
          - image/jpeg
          - image/png
          - image/bmp
          - image/x-portable-pixmap
          - image/tiff
          - multipart/form-data
          - application/json
          - image/x-jpeg-base64
          - image/x-png-base64
          - image/x-bmp-base64
          - image/x-tiff-base64
          - image/x-portable-pixmap-base64
      - $ref: '#/components/parameters/detector_multiface_policy'
      - $ref: '#/components/parameters/estimate_head_pose'
      - $ref: '#/components/parameters/estimate_emotions'
      - $ref: '#/components/parameters/estimate_mask'
      - $ref: '#/components/parameters/detect_landmarks68'
      - $ref: '#/components/parameters/extract_exif'
      - $ref: '#/components/parameters/estimate_quality'
      - $ref: '#/components/parameters/estimate_gaze'
      - $ref: '#/components/parameters/estimate_eyes_attributes'
      - $ref: '#/components/parameters/estimate_mouth_attributes'
      - $ref: '#/components/parameters/pitch_threshold'
      - $ref: '#/components/parameters/roll_threshold'
      - $ref: '#/components/parameters/yaw_threshold'
      - $ref: '#/components/parameters/warped_image'
      - $ref: '#/components/parameters/use_exif_info'
      - $ref: '#/components/parameters/estimate_face_quality'

      requestBody:
        content:
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/bmp:
            schema:
              type: string
              format: binary
          image/x-portable-pixmap:
            schema:
              type: string
              format: binary
          image/tiff:
            schema:
              type: string
              format: binary
          image/x-jpeg-base64:
            schema:
              type: string
              format: byte
          image/x-png-base64:
            schema:
              type: string
              format: byte
          image/x-bmp-base64:
            schema:
              type: string
              format: byte
          image/x-tiff-base64:
            schema:
              type: string
              format: byte
          image/x-portable-pixmap-base64:
            schema:
              type: string
              format: byte
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_image_schema'
            encoding:
              filename:
                contentType: |
                  image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff, image/x-jpeg-base64,
                  image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64, image/x-portable-pixmap-base64
          application/json:
            schema:
               $ref: '#/components/schemas/detect_json_request_body'

        required: true
      responses:
        201:
          description: Created.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/detected_images'
        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_query:
                  value:
                    error_code: 12012
                    desc: "Bad/incomplete input data"
                    detail: "Bad query parameters 'estimate_eyes_attributes'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                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_content_type_download_image:
                  value:
                    error_code: 11028
                    desc: Bad/incomplete input data
                    detail: Bad content type of image ''https://www.google.ru''
                    link: https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11028
                bad_content_type_multipart:
                  value:
                    error_code: 11029
                    desc: "Bad/incomplete input data"
                    detail: "Bad content type of image in multipart body"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11029"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        404:
          $ref: '#/components/responses/image_not_found'
        403:
          $ref: '#/components/responses/one_detection_rect_per_image'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/extractor:
    post:
      tags:
      - attributes
      summary: extract attributes
      description: Extract attributes from samples.
      operationId: extractAttributes
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      - $ref: '#/components/parameters/score_threshold'
      - $ref: '#/components/parameters/extract_descriptor'
      - $ref: '#/components/parameters/extract_basic_attributes'
      - $ref: '#/components/parameters/aggregate_attributes'
      - $ref: '#/components/parameters/ttl'

      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/uuid'
              maxItems: 8
              minItems: 1
              description: Sample ID list.
        required: true

      responses:
        201:
          description: Created.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/extracted_attributes'
        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_query_param:
                  value:
                    error_code: 12012
                    desc: "Bad/incomplete input data"
                    detail: "Bad query parameters 'extract_basic_attributes'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                sample_not_found:
                  value:
                    error_code: 11031
                    desc: "Bad/incomplete input data"
                    detail: "Sample 483037a5-8d67-427d-a498-f8f62bb06fb1 not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11031"
                bad_json:
                  value:
                    error_code: 12022
                    desc: "Bad/incomplete input data"
                    detail: "Failed to validate input json. Path: 'samples',  message: 'ensure this value has at least 1 items'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        403:
          $ref: '#/components/responses/lis_disabled'
        404:
          $ref: '#/components/responses/image_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/extractor/upgrade:
    post:
      tags:
      - attributes
      summary: upgrade attribute
      description: Append a descriptor of non-default version and/or replace basic attributes from samples.
      operationId: upgradeAttributes
      parameters:
      - $ref: '#/components/parameters/luna_account_id_non_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'

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

      responses:
        201:
          description: Success.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/reextracted_attribute'
        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_query_param:
                  value:
                    error_code: 12012
                    desc: "Bad/incomplete input data"
                    detail: "Bad query parameters 'extract_basic_attributes'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
                sample_not_found:
                  value:
                    error_code: 11031
                    desc: "Bad/incomplete input data"
                    detail: "Sample 483037a5-8d67-427d-a498-f8f62bb06fb1 not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11031"
                bad_json:
                  value:
                    error_code: 12022
                    desc: "Bad/incomplete input data"
                    detail: "Failed to validate input json. Path: 'samples.0',  message: 'String pattern mismatch - \"^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}\"'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
                bad_warp:
                  value:
                    error_code: 11043
                    desc: Bad/incomplete input data
                    detail: "Bad image size for face warped image"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11043"
        403:
          $ref: '#/components/responses/lis_disabled'
        404:
          $ref: '#/components/responses/image_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/handlers:
    post:
      tags:
      - handlers
      summary: create handler
      description: |
        Create a new handler. The handler determinates a list of rules for
        processing of input images. You can set parameters for detecting faces and/or human bodies and
        extracting attributes. You can set rules for matching attributes and
        creating faces from them.
      operationId: createHandler
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_Handler'
        required: true

      responses:
        201:
          description: Created.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: object
                properties:
                  handler_id:
                    $ref: '#/components/schemas/uuid'
                  url:
                    type: string
                    format: uri-reference
                required:
                - handler_id
                - url
              example:
                handler_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /1/handlers/b5d6fd45-fcca-453d-ac05-3e594054b813
        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"
                list_not_found:
                  value:
                    error_code: 22003
                    desc: "Object not found"
                    detail: "List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22033"
                bad_json:
                  value:
                    error_code: 12027
                    desc: "Bad/incomplete input data"
                    detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'List should have at most 30 items after validation, not 31'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        403:
          $ref: '#/components/responses/lambda_disabled'
        500:
          $ref: '#/components/responses/internal_server_error'

    get:
      tags:
      - handlers
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/handler_type'
      - $ref: '#/components/parameters/page'
      - $ref: '#/components/parameters/page_size'
      - in: query
        name: description
        schema:
          type: string
        description: Find all handlers with description similar to this parameter.

      summary: get handlers
      description: Get handlers by filters.
      operationId: getHandlers
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/HandlerInResponse'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: "Bad/incomplete input data"
                    detail: "Bad query parameters 'page'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/count:
    get:
      tags:
      - handlers
      summary: get handler count
      description: Get handler count.
      operationId:  getHandlerCount
      parameters:
      - $ref: '#/components/parameters/account_id'
      - in: query
        name: description
        schema:
          type: string
        description: Find all handlers with description similar to this parameter.
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/handler_type'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: object
                properties:
                  handlers_count:
                    $ref: '#/components/schemas/count'
                required:
                - handlers_count
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: "Bad/incomplete input data"
                    detail: "Bad query parameters 'description'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/validator:
    post:
      tags:
        - handlers
      summary: validate handler policies
      description: Validate handler policies before using them to create or update a handler.
      operationId: validatePolicies
      parameters:
        - $ref: '#/components/parameters/luna_account_id_required'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/handlers_validator'
        required: true

      responses:
        204:
          description: Validated.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        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"
                list_not_found:
                  value:
                    error_code: 22003
                    desc: Object not found
                    detail: List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
                bad_json:
                  value:
                    error_code: 12027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'List should have at most 30 items after validation, not 31'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/{handler_id}:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Handler ID.

    get:
      tags:
      - handlers
      summary: get handler
      description: Get handler by ID.
      operationId: getHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'

            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HandlerInResponse'
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
    put:
      tags:
      - handlers
      summary: Replace handler
      description: |
        Replace the handler. You can not update a part of handler.
      operationId: putHandler
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/New_Handler'
        required: true

      responses:
        204:
          description: Updated.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        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"
                list_not_found:
                  value:
                    error_code: 22003
                    desc: "Object not found"
                    detail: "List with id 'b5d6fd45-fcca-453d-ac05-3e594054b813' not found"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-22003"
                bad_json:
                  value:
                    error_code: 12027
                    desc: "Bad/incomplete input data"
                    detail: "Failed to validate input json. Path: 'policies.match_policy',  message: 'List should have at most 30 items after validation, not 31'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        403:
          $ref: '#/components/responses/lambda_disabled'
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
    head:
      tags:
      - handlers
      summary: check to exist a handler
      description:  Check a handler with id=handler_id existence.
      operationId: checkHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'

          description: OK.
        404:
          description: Handler not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - handlers
      summary: remove handler
      description: Remove handler by ID.
      operationId: removeHandler
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'

          description: The resource was deleted successfully.
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/handlers/{handler_id}/events:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Handler ID.
    post:
      tags: [events]
      summary: generate events
      description: |
        Generate events from images and/or raw descriptor data.
        If luna-events support is disabled on server, events will not be saved.
        Do not forget to send policies for a dynamic handler along with emitting events.

        Notes for incoming data:
          - set the image detection time, if necessary, otherwise it will be equal to the request time.
          - face or body *bounding boxes* passed with face or body wapred image will presented as sample detection rect
            in generated event.
      operationId: generateEvents
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/luna_event_time'
      - $ref: '#/components/parameters/luna_event_end_time'
      - $ref: '#/components/parameters/city'
      - $ref: '#/components/parameters/area'
      - $ref: '#/components/parameters/district'
      - $ref: '#/components/parameters/street'
      - $ref: '#/components/parameters/house_number'
      - $ref: '#/components/parameters/longitude'
      - $ref: '#/components/parameters/latitude'
      - $ref: '#/components/parameters/track_id'
      - $ref: '#/components/parameters/use_exif_info'
      - in: header
        name: Content-Type

        schema:
          type: string
          enum:
          - image/jpeg
          - image/png
          - image/bmp
          - image/x-portable-pixmap
          - image/tiff
          - multipart/form-data
          - application/json
          - image/x-jpeg-base64
          - image/x-png-base64
          - image/x-bmp-base64
          - image/x-tiff-base64
          - image/x-portable-pixmap-base64
          - application/x-sdk-descriptor
          - application/x-sdk-descriptor-base64
          - application/x-vl-xpk
          - application/x-vl-xpk-base64
      - in: query
        name: external_id
        schema:
          $ref: '#/components/schemas/event_external_id'
        description: External ID for created faces.
      - in: query
        name: user_data
        schema:
          description: User data for objects that will be generated.
          allOf:
            - $ref: '#/components/schemas/event_user_data'

        description: User data for created faces.
      - $ref: '#/components/parameters/image_type'

      - $ref: '#/components/parameters/aggregate_attributes'
      - $ref: '#/components/parameters/source'
      - $ref: '#/components/parameters/stream_id'
      - $ref: '#/components/parameters/no_cache'
      - $ref: '#/components/parameters/tags'
      requestBody:
        content:
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/bmp:
            schema:
              type: string
              format: binary
          image/x-portable-pixmap:
            schema:
              type: string
              format: binary
          image/tiff:
            schema:
              type: string
              format: binary
          application/x-sdk-descriptor:
            schema:
              $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk:
            schema:
              $ref: '#/components/schemas/xpk_file'
          image/x-jpeg-base64:
            schema:
              type: string
              format: byte
          image/x-png-base64:
            schema:
              type: string
              format: byte
          image/x-bmp-base64:
            schema:
              type: string
              format: byte
          image/x-tiff-base64:
            schema:
              type: string
              format: byte
          image/x-portable-pixmap-base64:
            schema:
              type: string
              format: binary
          application/x-sdk-descriptor-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/xpk_file'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_raw_data_schema_with_policies'
            encoding:
              filename:
                contentType: |
                  image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff,
                  application/x-sdk-descriptor, application/x-vl-xpk,
                  image/x-jpeg-base64, image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64,
                  image/x-portable-pixmap-base64, application/x-sdk-descriptor-base64, application/x-vl-xpk-base64
          application/json:
            schema:
              $ref: '#/components/schemas/emit_event_json_request_body'

        required: true
      responses:
        201:
          description: Created.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Cache-Handler-Version:
              $ref: '#/components/headers/cache_handler_version'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/emit_event_reply'
        400:
          $ref: '#/components/responses/generate_events_bad_input_data'
        403:
          $ref: '#/components/responses/generate_events_access_errors'
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/handlers/{handler_id}/events/raw:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Dynamic handler ID.
    post:
      tags: [events]
      summary: save event
      description: |
        Save event which was generated by the user. The event structure is similar to an event from handler response. Input events
         will send to the Sender also and to lambdas. Therefore these events are the same events except that the events were
        generated an `external handler`. Handler ID must belong to a dynamic handler.
      operationId: saveEvent
      parameters:
        - $ref: '#/components/parameters/luna_account_id_required'
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/applicationJsonContent'
        - $ref: '#/components/parameters/no_cache'
        - $ref: '#/components/parameters/wait_raw_event_saving'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/raw_event'
        required: true
      responses:
        201:
          description: Created.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Cache-Handler-Version:
              $ref: '#/components/headers/cache_handler_version'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Location:
              schema:
                type: string
                format: uri-reference
                example: http://127.0.0.1:5020/2/events/b5d6fd45-fcca-453d-ac05-3e594054b813
              description: Location of new events.
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/saved_event'
        202:
          description: Accepted.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Cache-Handler-Version:
              $ref: '#/components/headers/cache_handler_version'
            Content-Type:
              $ref: '#/components/headers/application_json'
            Location:
              schema:
                type: string
                format: uri-reference
                example: http://127.0.0.1:5020/2/events/b5d6fd45-fcca-453d-ac05-3e594054b813
              description: Location of new events.
              required: true
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/saved_event'
        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_input_data:
                  value:
                    error_code: 11027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'source',  message: 'Input should be a valid string'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11027"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        403:
          description: Access to this resource on the server is denied.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                not_dynamic_handler_error:
                  value:
                    error_code: 34007
                    desc: Forbidden
                    detail: Allowed to use only dynamic handler
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-34007"
                events_is_disabled:
                  value:
                    error_code: 11040
                    desc: Forbidden
                    detail: Luna Events service is disabled
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11040"
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/handlers/{handler_id}/stream_events:
    parameters:
    - in: path
      name: handler_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Handler ID.
    post:
      tags: [events]
      summary: generate stream events (beta)
      description: |
        Generate stream events from images.
        If luna-events support is disabled on server, events will not be saved.
        Do not forget to send policies for a dynamic handler along with emitting events.

        Notes for incoming data:
          - set the image detection time, if necessary, otherwise it will be equal to the request time.
          - face or body *bounding boxes* passed with face or body wapred image will presented as sample detection rect
            in generated event.
          - if no image specified as event source, the only specified metadata and detections will be processed.
      operationId: generateStreamEvents
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/msgpack_content'
      - $ref: '#/components/parameters/no_cache'

      requestBody:
        content:
          application/msgpack:
            schema:
              $ref: '#/components/schemas/stream_event_request_body'

        required: true
      responses:
        201:
          description: Created.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Cache-Handler-Version:
              $ref: '#/components/headers/cache_handler_version'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/emit_event_reply'
        400:
          $ref: '#/components/responses/generate_events_bad_input_data'
        403:
          $ref: '#/components/responses/generate_events_access_errors'
        404:
          $ref: '#/components/responses/handler_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/verifiers:
    post:
      tags:
      - verifiers
      summary: create verifier
      description: |
        Create a new verifier. The verifier determinates a list of rules for
        processing & verification of input images. You can set parameters for detecting faces and
        extracting attributes.
      operationId: createVerifier
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_verifier'
        required: true

      responses:
        201:
          description: Created.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: object
                properties:
                  verifier_id:
                    $ref: '#/components/schemas/uuid'
                  url:
                    type: string
                    format: uri-reference
                required:
                - verifier_id
                - url
              example:
                verifier_id: b5d6fd45-fcca-453d-ac05-3e594054b813
                url: /1/verifiers/b5d6fd45-fcca-453d-ac05-3e594054b813
        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: 12027
                    desc: Bad/incomplete input data
                    detail: "Failed to validate input json. Path: 'policies.match_policy.0.label',  message: 'Value length must be less than 36'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        500:
          $ref: '#/components/responses/internal_server_error'


    get:
      tags:
        - verifiers
      parameters:
        - $ref: '#/components/parameters/luna_request_id'
        - $ref: '#/components/parameters/account_id'
        - $ref: '#/components/parameters/verifier_description'
        - $ref: '#/components/parameters/page'
        - $ref: '#/components/parameters/page_size'

      summary: get verifiers
      description: Get verifiers by filters.
      operationId: getVerifiers
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/verifier_response'
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'page'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers/count:
    get:
      tags:
      - verifiers
      summary: count verifiers
      description: Count verifiers that satisfy the filters.
      operationId:  countVerifiers
      parameters:
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/verifier_description'
      - $ref: '#/components/parameters/luna_request_id'
      responses:
        200:
          description: OK.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                type: object
                properties:
                  verifiers_count:
                    $ref: '#/components/schemas/count'
                required:
                - verifiers_count
        400:
          description: Bad request.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                bad_query_param:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers/{verifier_id}:
    parameters:
    - in: path
      name: verifier_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Verifier ID.

    get:
      tags:
      - verifiers
      summary: get verifier
      description: Get verifier by ID.
      operationId: getVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/verifier_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_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'

    put:
      tags:
      - verifiers
      summary: replace verifier
      description: |
        Replace the verifier. You can not update a part of verifier.
      operationId: putVerifier
      parameters:
      - $ref: '#/components/parameters/luna_account_id_required'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/applicationJsonContent'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/new_verifier'
        required: true
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    description: Verifier current version (increases on update).
                    type: integer
                    minimum: 1
                    example: 111
                required:
                  - version
        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: 12027
                    desc: Bad/incomplete input data
                    detail: 'Failed to validate input json. Message: ''{''policies'': {''verification_threshold'': [''Value is not a valid float.'']}}'''
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12027"
                account_id_not_found:
                  value:
                    error_code: 11066
                    desc: Bad/incomplete input data
                    detail: Luna-Account-Id header not found
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11066"
                bad_account_id:
                  value:
                    error_code: 11037
                    desc: Bad/incomplete input data
                    detail: "Luna-Account-Id header is not UUID, format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11037"
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'

    head:
      tags:
      - verifiers
      summary: check verifier
      description:  Check the verifier existence.
      operationId: checkVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        200:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: OK.
        400:
          description: Bad request.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
        404:
          description: Verifier not found.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
        500:
          $ref: '#/components/responses/internal_server_error'

    delete:
      tags:
      - verifiers
      summary: remove verifier
      description: Remove verifier by ID.
      operationId: removeVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      responses:
        204:
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          description: Deleted.
        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_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
  /1/verifiers/{verifier_id}/raw:
    parameters:
    - in: path
      name: verifier_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Verifier ID.

    post:
      tags:
      - verifiers
      summary: raw verification
      description: |
        Raw API allows to do similarity and verification status calculations for input descriptors.
      operationId: rawVerification
      parameters:
      - $ref: '#/components/parameters/account_id'
      - $ref: '#/components/parameters/json_or_msgpack_content'
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id'
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/raw_verification_request_json'
          application/msgpack:
            schema:
              $ref: '#/components/schemas/raw_verification_request_msgpack'
        required: true
      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/raw_verification_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: 'policies.match_policy.0.label',  message: 'Value length must be less than 36'"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12022"
                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_descriptor:
                  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"
                bad_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_error'
        504:
          $ref: '#/components/responses/server_timeout_error'
  /1/verifiers/{verifier_id}/verifications:
    parameters:
    - in: path
      name: verifier_id
      schema:
        $ref: '#/components/schemas/uuid'
      required: true
      description: Verifier ID.

    post:
      tags:
      - verifiers
      summary: perform verification
      description: |
        Verify given images and/or descriptors against specified objects set.

        Notes for incoming data:
          - face or body *bounding boxes* passed with face or body wapred image will be ignored.

      operationId: postVerifier
      parameters:
      - $ref: '#/components/parameters/luna_request_id'
      - $ref: '#/components/parameters/account_id_required'
      - $ref: '#/components/parameters/face_ids'
      - $ref: '#/components/parameters/event_ids'
      - $ref: '#/components/parameters/attribute_ids'
      - $ref: '#/components/parameters/external_ids'
      - $ref: '#/components/parameters/use_exif_info'
      - $ref: '#/components/parameters/raw_or_face_image_type'
      - in: header
        name: Content-Type

        schema:
          type: string
          enum:
          - image/jpeg
          - image/png
          - image/bmp
          - image/x-portable-pixmap
          - image/tiff
          - multipart/form-data
          - application/json
          - image/x-jpeg-base64
          - image/x-png-base64
          - image/x-bmp-base64
          - image/x-tiff-base64
          - image/x-portable-pixmap-base64
          - application/x-sdk-descriptor
          - application/x-sdk-descriptor-base64
          - application/x-vl-xpk
          - application/x-vl-xpk-base64
      requestBody:
        content:
          image/jpeg:
            schema:
              type: string
              format: binary
          image/png:
            schema:
              type: string
              format: binary
          image/bmp:
            schema:
              type: string
              format: binary
          image/x-portable-pixmap:
            schema:
              type: string
              format: binary
          image/tiff:
            schema:
              type: string
              format: binary
          application/x-sdk-descriptor:
            schema:
              $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk:
            schema:
              $ref: '#/components/schemas/xpk_file'
          image/x-jpeg-base64:
            schema:
              type: string
              format: byte
          image/x-png-base64:
            schema:
              type: string
              format: byte
          image/x-bmp-base64:
            schema:
              type: string
              format: byte
          image/x-tiff-base64:
            schema:
              type: string
              format: byte
          image/x-portable-pixmap-base64:
            schema:
              type: string
              format: binary
          application/x-sdk-descriptor-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/sdk_descriptor'
          application/x-vl-xpk-base64:
            schema:
              allOf:
              - type: string
                format: byte
              - $ref: '#/components/schemas/xpk_file'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/multipart_verifier_payload'
            encoding:
              filename:
                contentType: |
                  image/jpeg, image/png, image/bmp, image/x-portable-pixmap, image/tiff,
                  application/x-sdk-descriptor, application/x-vl-xpk,
                  image/x-jpeg-base64, image/x-png-base64, image/x-bmp-base64, image/x-tiff-base64,
                  image/x-portable-pixmap-base64, application/x-sdk-descriptor-base64, application/x-vl-xpk-base64
          application/json:
            schema:
              $ref: '#/components/schemas/verify_json_request_body'
      responses:
        200:
          description: OK.
          headers:
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
            Content-Type:
              $ref: '#/components/headers/application_json'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/verifier_id_verification_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_query:
                  value:
                    error_code: 12012
                    desc: Bad/incomplete input data
                    detail: Bad query parameters 'account_id'
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-12012"
        403:
          description: Access to this resource on the server is denied.
          headers:
            Content-Type:
              $ref: '#/components/headers/application_json'
            Luna-Request-Id:
              $ref: '#/components/headers/luna_request_id'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
              examples:
                events_is_disabled:
                  value:
                    error_code: 11040
                    desc: Forbidden
                    detail: Luna Events service is disabled
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11040"
                lis_is_disabled:
                  value:
                    error_code: 11070
                    desc: Forbidden
                    detail: Luna Image Store service is disabled
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11070"
                fsdk_liveness_disabled:
                  value:
                    error_code: 11055
                    desc: Forbidden
                    detail: "License problem: Liveness v.2 feature disabled"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
                liveness_disabled:
                  value:
                    error_code: 11055
                    desc: Forbidden
                    detail: "License problem: Liveness feature disabled"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
                deepfake_disabled:
                  value:
                    error_code: 11055
                    desc: Forbidden
                    detail: "License problem: Deepafke feature disabled"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
                licence_expired:
                  value:
                    error_code: 11055
                    desc: Forbidden
                    detail: "License problem: License expired"
                    link: "https://docs.visionlabs.ai/info/luna/troubleshooting/errors-description/code-11055"
        404:
          $ref: '#/components/responses/verifier_not_found'
        500:
          $ref: '#/components/responses/internal_server_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-12024"
        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'
        504:
          $ref: '#/components/responses/server_timeout_error'