/*
 * 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 the top-level object that the response includes when the request
 * succeeds.
 *
 * @extends models['Response']
 */
class SearchResponse extends models['Response'] {
  /**
   * Create a SearchResponse.
   * @property {object} [queryContext] An object that contains the query string
   * that Bing used for the request. This object contains the query string as
   * entered by the user. It may also contain an altered query string that Bing
   * used for the query if the query string contained a spelling mistake.
   * @property {string} [queryContext.originalQuery] The query string as
   * specified in the request.
   * @property {string} [queryContext.alteredQuery] The query string used by
   * Bing to perform the query. Bing uses the altered query string if the
   * original query string contained spelling mistakes. For example, if the
   * query string is "saling downwind", the altered query string will be
   * "sailing downwind". This field is included only if the original query
   * string contains a spelling mistake.
   * @property {string} [queryContext.alterationOverrideQuery] The query string
   * to use to force Bing to use the original string. For example, if the query
   * string is "saling downwind", the override query string will be "+saling
   * downwind". Remember to encode the query string which results in
   * "%2Bsaling+downwind". This field is included only if the original query
   * string contains a spelling mistake.
   * @property {boolean} [queryContext.adultIntent] A Boolean value that
   * indicates whether the specified query has adult intent. The value is true
   * if the query has adult intent; otherwise, false.
   * @property {boolean} [queryContext.askUserForLocation] A Boolean value that
   * indicates whether Bing requires the user's location to provide accurate
   * results. If you specified the user's location by using the
   * X-MSEdge-ClientIP and X-Search-Location headers, you can ignore this
   * field. For location aware queries, such as "today's weather" or
   * "restaurants near me" that need the user's location to provide accurate
   * results, this field is set to true. For location aware queries that
   * include the location (for example, "Seattle weather"), this field is set
   * to false. This field is also set to false for queries that are not
   * location aware, such as "best sellers".
   * @property {boolean} [queryContext.isTransactional]
   * @property {object} [webPages] A list of webpages that are relevant to the
   * search query.
   * @property {array} [webPages.value] A list of webpages that are relevant to
   * the query.
   * @property {boolean} [webPages.someResultsRemoved] A Boolean value that
   * indicates whether the response excluded some results from the answer. If
   * Bing excluded some results, the value is true.
   * @property {object} [images] A list of images that are relevant to the
   * search query.
   * @property {number} [images.nextOffset]
   * @property {array} [images.value] A list of image objects that are relevant
   * to the query. If there are no results, the List is empty.
   * @property {array} [images.queryExpansions]
   * @property {array} [images.similarTerms]
   * @property {array} [images.relatedSearches]
   * @property {object} [news] A list of news articles that are relevant to the
   * search query.
   * @property {array} [news.value] An array of NewsArticle objects that
   * contain information about news articles that are relevant to the query. If
   * there are no results to return for the request, the array is empty.
   * @property {string} [news.location]
   * @property {object} [relatedSearches] A list of related queries made by
   * others.
   * @property {array} [relatedSearches.value] A list of related queries that
   * were made by others.
   * @property {object} [spellSuggestions] The query string that likely
   * represents the user's intent.
   * @property {array} [spellSuggestions.value] A list of suggested query
   * strings that may represent the user's intention. The list contains only
   * one Query object.
   * @property {object} [timeZone] The date and time of one or more geographic
   * locations.
   * @property {object} [timeZone.primaryCityTime] The data and time, in UTC,
   * of the geographic location specified in the query. If the query specified
   * a specific geographic location (for example, a city), this object contains
   * the name of the geographic location and the current date and time of the
   * location, in UTC. If the query specified a general geographic location,
   * such as a state or country, this object contains the date and time of the
   * primary city or state found in the specified state or country. If the
   * location contains additional time zones, the otherCityTimes field contains
   * the data and time of cities or states located in the other time zones.
   * @property {string} [timeZone.primaryCityTime.location] The name of the
   * geographical location.For example, County; City; City, State; City, State,
   * Country; or Time Zone.
   * @property {string} [timeZone.primaryCityTime.time] The data and time
   * specified in the form, YYYY-MM-DDThh;mm:ss.ssssssZ.
   * @property {string} [timeZone.primaryCityTime.utcOffset] The offset from
   * UTC. For example, UTC-7.
   * @property {array} [timeZone.otherCityTimes] A list of dates and times of
   * nearby time zones.
   * @property {object} [videos] A list of videos that are relevant to the
   * search query.
   * @property {array} [videos.value] A list of video objects that are relevant
   * to the query.
   * @property {number} [videos.nextOffset]
   * @property {array} [videos.queryExpansions]
   * @property {array} [videos.relatedSearches]
   * @property {object} [computation] The answer to a math expression or units
   * conversion expression.
   * @property {string} [computation.expression] The math or conversion
   * expression. If the query contains a request to convert units of measure
   * (for example, meters to feet), this field contains the from units and
   * value contains the to units. If the query contains a mathematical
   * expression such as 2+2, this field contains the expression and value
   * contains the answer. Note that mathematical expressions may be normalized.
   * For example, if the query was sqrt(4^2+8^2), the normalized expression may
   * be sqrt((4^2)+(8^2)). If the user's query is a math question and the
   * textDecorations query parameter is set to true, the expression string may
   * include formatting markers. For example, if the user's query is log(2),
   * the normalized expression includes the subscript markers. For more
   * information, see Hit Highlighting.
   * @property {string} [computation.value] The expression's answer.
   * @property {object} [rankingResponse] The order that Bing suggests that you
   * display the search results in.
   * @property {object} [rankingResponse.pole] The search results that should
   * be afforded the most visible treatment (for example, displayed above the
   * mainline and sidebar).
   * @property {array} [rankingResponse.pole.items] A list of search result
   * items to display in the group.
   * @property {object} [rankingResponse.mainline] The search results to
   * display in the mainline.
   * @property {array} [rankingResponse.mainline.items] A list of search result
   * items to display in the group.
   * @property {object} [rankingResponse.sidebar] The search results to display
   * in the sidebar.
   * @property {array} [rankingResponse.sidebar.items] A list of search result
   * items to display in the group.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of SearchResponse
   *
   * @returns {object} metadata of SearchResponse
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'SearchResponse',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: '_type',
          clientName: '_type'
        },
        uberParent: 'ResponseBase',
        className: 'SearchResponse',
        modelProperties: {
          _type: {
            required: true,
            serializedName: '_type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          webSearchUrl: {
            required: false,
            readOnly: true,
            serializedName: 'webSearchUrl',
            type: {
              name: 'String'
            }
          },
          queryContext: {
            required: false,
            readOnly: true,
            serializedName: 'queryContext',
            type: {
              name: 'Composite',
              className: 'QueryContext'
            }
          },
          webPages: {
            required: false,
            readOnly: true,
            serializedName: 'webPages',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'WebWebAnswer'
            }
          },
          images: {
            required: false,
            readOnly: true,
            serializedName: 'images',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'Images'
            }
          },
          news: {
            required: false,
            readOnly: true,
            serializedName: 'news',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'News'
            }
          },
          relatedSearches: {
            required: false,
            readOnly: true,
            serializedName: 'relatedSearches',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'RelatedSearchesRelatedSearchAnswer'
            }
          },
          spellSuggestions: {
            required: false,
            readOnly: true,
            serializedName: 'spellSuggestions',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'SpellSuggestions'
            }
          },
          timeZone: {
            required: false,
            readOnly: true,
            serializedName: 'timeZone',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'TimeZone'
            }
          },
          videos: {
            required: false,
            readOnly: true,
            serializedName: 'videos',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'Videos'
            }
          },
          computation: {
            required: false,
            readOnly: true,
            serializedName: 'computation',
            type: {
              name: 'Composite',
              polymorphicDiscriminator: {
                serializedName: '_type',
                clientName: '_type'
              },
              uberParent: 'ResponseBase',
              className: 'Computation'
            }
          },
          rankingResponse: {
            required: false,
            readOnly: true,
            serializedName: 'rankingResponse',
            type: {
              name: 'Composite',
              className: 'RankingRankingResponse'
            }
          }
        }
      }
    };
  }
}

module.exports = SearchResponse;
