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

/**
 * A JSON object that contains information about the image to get insights of.
 * Specify this object only in a knowledgeRequest form data.
 *
 */
class VisualSearchRequest {
  /**
   * Create a VisualSearchRequest.
   * @property {object} [imageInfo] A JSON object that identities the image to
   * get insights of.
   * @property {string} [imageInfo.imageInsightsToken] An image insights token.
   * To get the insights token, call one of the Image Search APIs (for example,
   * /images/search). In the search results, the
   * [Image](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image)
   * object's
   * [imageInsightsToken](https://docs.microsoft.com/en-us/rest/api/cognitiveservices/bing-images-api-v7-reference#image-imageinsightstoken)
   * field contains the token. The imageInsightsToken and url fields mutually
   * exclusive; do not specify both. Do not specify an insights token if the
   * request includes the image form data.
   * @property {string} [imageInfo.url] The URL of the input image. The
   * imageInsightsToken and url fields are mutually exclusive; do not specify
   * both. Do not specify the URL if the request includes the image form data.
   * @property {object} [imageInfo.cropArea] A JSON object consisting of
   * coordinates specifying the four corners of a cropped rectangle within the
   * input image. Use the crop area to identify the region of interest in the
   * image. You can apply the crop area to the images specified using the
   * imageInsightsToken or url fields, or an image binary specified in an image
   * form data.
   * @property {number} [imageInfo.cropArea.top] The top coordinate of the
   * region to be cropped. The coordinate is a fractional value of the original
   * image's height and is measured from the top edge of the image. Specify the
   * coordinate as a value from 0.0 through 1.0.
   * @property {number} [imageInfo.cropArea.bottom] The bottom coordinate of
   * the region to be cropped. The coordinate is a fractional value of the
   * original image's height and is measured from the top edge of the image.
   * Specify the coordinate as a value from 0.0 through 1.0.
   * @property {number} [imageInfo.cropArea.left] The left coordinate of the
   * region to be cropped. The coordinate is a fractional value of the original
   * image's width and is measured from the left edge of the image. Specify the
   * coordinate as a value from 0.0 through 1.0.
   * @property {number} [imageInfo.cropArea.right] The right coordinate of the
   * region to be cropped. The coordinate is a fractional value of the original
   * image's width and is measured from the left edge of the image. Specify the
   * coordinate as a value from 0.0 through 1.0.
   * @property {object} [knowledgeRequest] A JSON object containing information
   * about the request, such as filters, or a description.
   * @property {object} [knowledgeRequest.filters] A key-value object
   * consisting of filters that may be specified to limit the results returned
   * by the API.
   * @property {string} [knowledgeRequest.filters.site] The URL of the site to
   * return similar images and similar products from. (e.g., "www.bing.com",
   * "bing.com").
   */
  constructor() {
  }

  /**
   * Defines the metadata of VisualSearchRequest
   *
   * @returns {object} metadata of VisualSearchRequest
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'VisualSearchRequest',
      type: {
        name: 'Composite',
        className: 'VisualSearchRequest',
        modelProperties: {
          imageInfo: {
            required: false,
            serializedName: 'imageInfo',
            type: {
              name: 'Composite',
              className: 'ImageInfo'
            }
          },
          knowledgeRequest: {
            required: false,
            serializedName: 'knowledgeRequest',
            type: {
              name: 'Composite',
              className: 'KnowledgeRequest'
            }
          }
        }
      }
    };
  }
}

module.exports = VisualSearchRequest;
