/*
 * 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 recognized entity.
 *
 * @extends models['Response']
 */
class RecognizedEntity extends models['Response'] {
  /**
   * Create a RecognizedEntity.
   * @property {object} [entity] The entity that was recognized. The following
   * are the possible entity objects: Person
   * @property {string} [entity.name] The name of the thing represented by this
   * object.
   * @property {string} [entity.url] The URL to get more information about the
   * thing represented by this object.
   * @property {object} [entity.image] An image of the item.
   * @property {object} [entity.image.thumbnail] The URL to a thumbnail of the
   * image
   * @property {string} [entity.image.imageInsightsToken] The token that you
   * use in a subsequent call to the Image Search API to get additional
   * information about the image. For information about using this token, see
   * the insightsToken query parameter.
   * @property {object} [entity.image.insightsMetadata] A count of the number
   * of websites where you can shop or perform other actions related to the
   * image. For example, if the image is of an apple pie, this object includes
   * a count of the number of websites where you can buy an apple pie. To
   * indicate the number of offers in your UX, include badging such as a
   * shopping cart icon that contains the count. When the user clicks on the
   * icon, use imageInsightsToken to get the list of websites.
   * @property {number} [entity.image.insightsMetadata.shoppingSourcesCount]
   * The number of websites that offer goods of the products seen in the image.
   * @property {number} [entity.image.insightsMetadata.recipeSourcesCount] The
   * number of websites that offer recipes of the food seen in the image.
   * @property {object} [entity.image.insightsMetadata.aggregateOffer] A
   * summary of the online offers of products found in the image. For example,
   * if the image is of a dress, the offer might identify the lowest price and
   * the number of offers found. Only visually similar products insights
   * include this field. The offer includes the following fields: Name,
   * AggregateRating, OfferCount, and LowPrice.
   * @property {array} [entity.image.insightsMetadata.aggregateOffer.offers] A
   * list of offers from merchants that have offerings related to the image.
   * @property {string} [entity.image.imageId] Unique Id for the image
   * @property {string} [entity.image.accentColor] A three-byte hexadecimal
   * number that represents the color that dominates the image. Use the color
   * as the temporary background in your client until the image is loaded.
   * @property {string} [entity.image.visualWords] Visual representation of the
   * image. Used for getting more sizes
   * @property {string} [entity.description] A short description of the item.
   * @property {string} [entity.alternateName] An alias for the item
   * @property {string} [entity.bingId] An ID that uniquely identifies this
   * item.
   * @property {number} [matchConfidence] The confidence that Bing has that the
   * entity in the image matches this entity. The confidence ranges from 0.0
   * through 1.0 with 1.0 being very confident.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of RecognizedEntity
   *
   * @returns {object} metadata of RecognizedEntity
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'RecognizedEntity',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: '_type',
          clientName: '_type'
        },
        uberParent: 'ResponseBase',
        className: 'RecognizedEntity',
        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'
            }
          },
          entity: {
            required: false,
            readOnly: true,
            serializedName: 'entity',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'Thing'
            }
          },
          matchConfidence: {
            required: false,
            readOnly: true,
            serializedName: 'matchConfidence',
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = RecognizedEntity;
