/*
 * 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');

/**
 * The top-level object that the response includes when an image insights
 * request succeeds. For information about requesting image insights, see the
 * [insightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#insightstoken)
 * query parameter. The modules query parameter affects the fields that Bing
 * includes in the response. If you set
 * [modules](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#modulesrequested)
 * to only Caption, then this object includes only the imageCaption field.
 *
 * @extends models['Response']
 */
class ImageInsights extends models['Response'] {
  /**
   * Create a ImageInsights.
   * @property {string} [imageInsightsToken] A token that you use in a
   * subsequent call to the Image Search API to get more information about the
   * image. For information about using this token, see the insightsToken query
   * parameter. This token has the same usage as the token in the Image object.
   * @property {object} [bestRepresentativeQuery] The query term that best
   * represents the image. Clicking the link in the Query object, takes the
   * user to a webpage with more pictures of the image.
   * @property {string} [bestRepresentativeQuery.text] The query string. Use
   * this string as the query term in a new search request.
   * @property {string} [bestRepresentativeQuery.displayText] The display
   * version of the query term. This version of the query term may contain
   * special characters that highlight the search term found in the query
   * string. The string contains the highlighting characters only if the query
   * enabled hit highlighting
   * @property {string} [bestRepresentativeQuery.webSearchUrl] The URL that
   * takes the user to the Bing search results page for the query.Only related
   * search results include this field.
   * @property {string} [bestRepresentativeQuery.searchLink] The URL that you
   * use to get the results of the related search. Before using the URL, you
   * must append query parameters as appropriate and include the
   * Ocp-Apim-Subscription-Key header. Use this URL if you're displaying the
   * results in your own user interface. Otherwise, use the webSearchUrl URL.
   * @property {object} [bestRepresentativeQuery.thumbnail] The URL to a
   * thumbnail of a related image.
   * @property {object} [bestRepresentativeQuery.thumbnail.thumbnail] The URL
   * to a thumbnail of the image
   * @property {string} [bestRepresentativeQuery.thumbnail.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} [bestRepresentativeQuery.thumbnail.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}
   * [bestRepresentativeQuery.thumbnail.insightsMetadata.shoppingSourcesCount]
   * The number of websites that offer goods of the products seen in the image.
   * @property {number}
   * [bestRepresentativeQuery.thumbnail.insightsMetadata.recipeSourcesCount]
   * The number of websites that offer recipes of the food seen in the image.
   * @property {object}
   * [bestRepresentativeQuery.thumbnail.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}
   * [bestRepresentativeQuery.thumbnail.insightsMetadata.aggregateOffer.offers]
   * A list of offers from merchants that have offerings related to the image.
   * @property {string} [bestRepresentativeQuery.thumbnail.imageId] Unique Id
   * for the image
   * @property {string} [bestRepresentativeQuery.thumbnail.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} [bestRepresentativeQuery.thumbnail.visualWords] Visual
   * representation of the image. Used for getting more sizes
   * @property {object} [imageCaption] The caption to use for the image.
   * @property {string} [imageCaption.caption] A caption about the image.
   * @property {string} [imageCaption.dataSourceUrl] The URL to the website
   * where the caption was found. You must attribute the caption to the source.
   * For example, by displaying the domain name from the URL next to the
   * caption and using the URL to link to the source website.
   * @property {array} [imageCaption.relatedSearches] A list of entities found
   * in the caption. Use the contents of the Query object to find the entity in
   * the caption and create a link. The link takes the user to images of the
   * entity.
   * @property {object} [relatedCollections] A list of links to webpages that
   * contain related images.
   * @property {array} [relatedCollections.value] A list of webpages that
   * contain related images.
   * @property {object} [pagesIncluding] A list of webpages that contain the
   * image. To access the webpage, use the URL in the image's hostPageUrl
   * field.
   * @property {array} [pagesIncluding.value] A list of images.
   * @property {object} [shoppingSources] A list of merchants that offer items
   * related to the image. For example, if the image is of an apple pie, the
   * list contains merchants that are selling apple pies.
   * @property {array} [shoppingSources.offers] A list of offers from merchants
   * that have offerings related to the image.
   * @property {object} [relatedSearches] A list of related queries made by
   * others.
   * @property {array} [relatedSearches.value] A list of related searches.
   * @property {object} [recipes] A list of recipes related to the image. For
   * example, if the image is of an apple pie, the list contains recipes for
   * making an apple pie.
   * @property {array} [recipes.value] A list of recipes.
   * @property {object} [visuallySimilarImages] A list of images that are
   * visually similar to the original image. For example, if the specified
   * image is of a sunset over a body of water, the list of similar images are
   * of a sunset over a body of water. If the specified image is of a person,
   * similar images might be of the same person or they might be of persons
   * dressed similarly or in a similar setting. The criteria for similarity
   * continues to evolve.
   * @property {array} [visuallySimilarImages.value] A list of images.
   * @property {object} [visuallySimilarProducts] A list of images that contain
   * products that are visually similar to products found in the original
   * image. For example, if the specified image contains a dress, the list of
   * similar images contain a dress. The image provides summary information
   * about offers that Bing found online for the product.
   * @property {array} [visuallySimilarProducts.value] A list of images.
   * @property {object} [recognizedEntityGroups] A list of groups that contain
   * images of entities that match the entity found in the specified image. For
   * example, the response might include images from the general celebrity
   * group if the entity was recognized in that group.
   * @property {array} [recognizedEntityGroups.value] A list of recognized
   * entities.
   * @property {object} [imageTags] A list of characteristics of the content
   * found in the image. For example, if the image is of a person, the tags
   * might indicate the person's gender and the type of clothes they're
   * wearing.
   * @property {array} [imageTags.value] A list of tags that describe the
   * characteristics of the content found in the image. For example, if the
   * image is of a musical artist, the list might include Female, Dress, and
   * Music to indicate the person is female music artist that's wearing a
   * dress.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ImageInsights
   *
   * @returns {object} metadata of ImageInsights
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ImageInsights',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: '_type',
          clientName: '_type'
        },
        uberParent: 'ResponseBase',
        className: 'ImageInsights',
        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'
            }
          },
          imageInsightsToken: {
            required: false,
            readOnly: true,
            serializedName: 'imageInsightsToken',
            type: {
              name: 'String'
            }
          },
          bestRepresentativeQuery: {
            required: false,
            readOnly: true,
            serializedName: 'bestRepresentativeQuery',
            type: {
              name: 'Composite',
              className: 'Query'
            }
          },
          imageCaption: {
            required: false,
            readOnly: true,
            serializedName: 'imageCaption',
            type: {
              name: 'Composite',
              className: 'ImageInsightsImageCaption'
            }
          },
          relatedCollections: {
            required: false,
            readOnly: true,
            serializedName: 'relatedCollections',
            type: {
              name: 'Composite',
              className: 'RelatedCollectionsModule'
            }
          },
          pagesIncluding: {
            required: false,
            readOnly: true,
            serializedName: 'pagesIncluding',
            type: {
              name: 'Composite',
              className: 'ImagesModule'
            }
          },
          shoppingSources: {
            required: false,
            readOnly: true,
            serializedName: 'shoppingSources',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'AggregateOffer'
            }
          },
          relatedSearches: {
            required: false,
            readOnly: true,
            serializedName: 'relatedSearches',
            type: {
              name: 'Composite',
              className: 'RelatedSearchesModule'
            }
          },
          recipes: {
            required: false,
            readOnly: true,
            serializedName: 'recipes',
            type: {
              name: 'Composite',
              className: 'RecipesModule'
            }
          },
          visuallySimilarImages: {
            required: false,
            readOnly: true,
            serializedName: 'visuallySimilarImages',
            type: {
              name: 'Composite',
              className: 'ImagesModule'
            }
          },
          visuallySimilarProducts: {
            required: false,
            readOnly: true,
            serializedName: 'visuallySimilarProducts',
            type: {
              name: 'Composite',
              className: 'ImagesModule'
            }
          },
          recognizedEntityGroups: {
            required: false,
            readOnly: true,
            serializedName: 'recognizedEntityGroups',
            type: {
              name: 'Composite',
              className: 'RecognizedEntitiesModule'
            }
          },
          imageTags: {
            required: false,
            readOnly: true,
            serializedName: 'imageTags',
            type: {
              name: 'Composite',
              className: 'ImageTagsModule'
            }
          }
        }
      }
    };
  }
}

module.exports = ImageInsights;
