/*
 * 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 an expression and its answer
 *
 * @extends models['Answer']
 */
class Computation extends models['Answer'] {
  /**
   * Create a Computation.
   * @property {string} 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} value The expression's answer.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Computation
   *
   * @returns {object} metadata of Computation
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Computation',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: '_type',
          clientName: '_type'
        },
        uberParent: 'ResponseBase',
        className: 'Computation',
        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'
            }
          },
          followUpQueries: {
            required: false,
            readOnly: true,
            serializedName: 'followUpQueries',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'QueryElementType',
                  type: {
                    name: 'Composite',
                    className: 'Query'
                  }
              }
            }
          },
          expression: {
            required: true,
            serializedName: 'expression',
            type: {
              name: 'String'
            }
          },
          value: {
            required: true,
            serializedName: 'value',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = Computation;
