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

/**
 * Defines an image tile.
 *
 */
class TrendingImagesTile {
  /**
   * Create a TrendingImagesTile.
   * @property {object} query A query that returns a Bing search results page
   * with more images of the subject. For example, if the category is Popular
   * People Searches, then the thumbnail is of a popular person. The query
   * would return a Bing search results page with more images of that person.
   * @property {string} [query.text] The query string. Use this string as the
   * query term in a new search request.
   * @property {string} [query.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} [query.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} [query.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} [query.thumbnail] The URL to a thumbnail of a related
   * image.
   * @property {object} [query.thumbnail.thumbnail] The URL to a thumbnail of
   * the image
   * @property {string} [query.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} [query.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} [query.thumbnail.insightsMetadata.shoppingSourcesCount]
   * The number of websites that offer goods of the products seen in the image.
   * @property {number} [query.thumbnail.insightsMetadata.recipeSourcesCount]
   * The number of websites that offer recipes of the food seen in the image.
   * @property {object} [query.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} [query.thumbnail.insightsMetadata.aggregateOffer.offers]
   * A list of offers from merchants that have offerings related to the image.
   * @property {string} [query.thumbnail.imageId] Unique Id for the image
   * @property {string} [query.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} [query.thumbnail.visualWords] Visual representation of
   * the image. Used for getting more sizes
   * @property {object} image The image's thumbnail.
   * @property {object} [image.thumbnail] The URL to a thumbnail of the image
   * @property {string} [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} [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} [image.insightsMetadata.shoppingSourcesCount] The
   * number of websites that offer goods of the products seen in the image.
   * @property {number} [image.insightsMetadata.recipeSourcesCount] The number
   * of websites that offer recipes of the food seen in the image.
   * @property {object} [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} [image.insightsMetadata.aggregateOffer.offers] A list of
   * offers from merchants that have offerings related to the image.
   * @property {string} [image.imageId] Unique Id for the image
   * @property {string} [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} [image.visualWords] Visual representation of the image.
   * Used for getting more sizes
   */
  constructor() {
  }

  /**
   * Defines the metadata of TrendingImagesTile
   *
   * @returns {object} metadata of TrendingImagesTile
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'TrendingImages/Tile',
      type: {
        name: 'Composite',
        className: 'TrendingImagesTile',
        modelProperties: {
          query: {
            required: true,
            serializedName: 'query',
            type: {
              name: 'Composite',
              className: 'Query'
            }
          },
          image: {
            required: true,
            serializedName: 'image',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'ImageObject'
            }
          }
        }
      }
    };
  }
}

module.exports = TrendingImagesTile;
