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

/**
 * Indicates that a monetary commitment is required for this offer
 *
 * @extends models['OfferTermInfo']
 */
class MonetaryCommitment extends models['OfferTermInfo'] {
  /**
   * Create a MonetaryCommitment.
   * @member {object} [tieredDiscount] The list of key/value pairs for the
   * tiered meter rates, in the format 'key':'value' where key = price, and
   * value = the corresponding discount percentage. This field is used only by
   * offer terms of type 'Monetary Commitment'.
   * @member {array} [excludedMeterIds] An array of meter ids that are excluded
   * from the given offer terms.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of MonetaryCommitment
   *
   * @returns {object} metadata of MonetaryCommitment
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Monetary Commitment',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'Name',
          clientName: 'name'
        },
        uberParent: 'OfferTermInfo',
        className: 'MonetaryCommitment',
        modelProperties: {
          effectiveDate: {
            required: false,
            serializedName: 'EffectiveDate',
            type: {
              name: 'DateTime'
            }
          },
          name: {
            required: true,
            serializedName: 'Name',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          tieredDiscount: {
            required: false,
            serializedName: 'TieredDiscount',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'NumberElementType',
                  type: {
                    name: 'Number'
                  }
              }
            }
          },
          excludedMeterIds: {
            required: false,
            serializedName: 'ExcludedMeterIds',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'UuidElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = MonetaryCommitment;
