/*
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License. See License.txt in the project root for
 * license information.
 *
 * Code generated by Microsoft (R) AutoRest Code Generator.
 * Changes may cause incorrect behavior and will be lost if the code is
 * regenerated.
 */

'use strict';

const models = require('./index');

/**
 * Defines a region of the image where an entity was found and a list of
 * entities that might match it.
 *
 * @extends models['Response']
 */
class RecognizedEntityRegion extends models['Response'] {
  /**
   * Create a RecognizedEntityRegion.
   * @property {object} [region] A region of the image that contains an entity.
   * The values of the rectangle are relative to the width and height of the
   * original image and are in the range 0.0 through 1.0. For example, if the
   * image is 300x200 and the region's top, left corner is at point (10, 20)
   * and the bottom, right corner is at point (290, 150), then the normalized
   * rectangle is: Left = 0.0333333333333333, Top = 0.1, Right =
   * 0.9666666666666667, Bottom = 0.75. For people, the region represents the
   * person's face.
   * @property {number} [region.left] The left coordinate.
   * @property {number} [region.top] The top coordinate
   * @property {number} [region.right] The right coordinate
   * @property {number} [region.bottom] The bottom coordinate
   * @property {array} [matchingEntities] A list of entities that Bing believes
   * match the entity found in the region. The entities are in descending order
   * of confidence (see the matchConfidence field of RecognizedEntity).
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of RecognizedEntityRegion
   *
   * @returns {object} metadata of RecognizedEntityRegion
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'RecognizedEntityRegion',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: '_type',
          clientName: '_type'
        },
        uberParent: 'ResponseBase',
        className: 'RecognizedEntityRegion',
        modelProperties: {
          _type: {
            required: true,
            serializedName: '_type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          readLink: {
            required: false,
            readOnly: true,
            serializedName: 'readLink',
            type: {
              name: 'String'
            }
          },
          webSearchUrl: {
            required: false,
            readOnly: true,
            serializedName: 'webSearchUrl',
            type: {
              name: 'String'
            }
          },
          region: {
            required: false,
            readOnly: true,
            serializedName: 'region',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'NormalizedRectangle'
            }
          },
          matchingEntities: {
            required: false,
            readOnly: true,
            serializedName: 'matchingEntities',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'RecognizedEntityElementType',
                  type: {
                    name: 'Composite',
                    polymorphicDiscriminator: {
                      serializedName: '_type',
                      clientName: '_type'
                    },
                    uberParent: 'ResponseBase',
                    className: 'RecognizedEntity'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = RecognizedEntityRegion;
