/*
 * 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 cache expiration action for the delivery rule.
 *
 * @extends models['DeliveryRuleAction']
 */
class DeliveryRuleCacheExpirationAction extends models['DeliveryRuleAction'] {
  /**
   * Create a DeliveryRuleCacheExpirationAction.
   * @property {object} parameters Defines the parameters for the action.
   * @property {string} [parameters.cacheBehavior] Caching behavior for the
   * requests that include query strings. Possible values include:
   * 'BypassCache', 'Override', 'SetIfMissing'
   * @property {string} [parameters.cacheDuration] The duration for which the
   * content needs to be cached. Allowed format is [d.]hh:mm:ss
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of DeliveryRuleCacheExpirationAction
   *
   * @returns {object} metadata of DeliveryRuleCacheExpirationAction
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'CacheExpiration',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'name',
          clientName: 'name'
        },
        uberParent: 'DeliveryRuleAction',
        className: 'DeliveryRuleCacheExpirationAction',
        modelProperties: {
          name: {
            required: true,
            serializedName: 'name',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          parameters: {
            required: true,
            serializedName: 'parameters',
            defaultValue: {},
            type: {
              name: 'Composite',
              className: 'CacheExpirationActionParameters'
            }
          }
        }
      }
    };
  }
}

module.exports = DeliveryRuleCacheExpirationAction;
