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

/**
 * Action and its trigger that will be performed by Key Vault over the lifetime
 * of a certificate.
 *
 */
class LifetimeAction {
  /**
   * Create a LifetimeAction.
   * @member {object} [trigger] The condition that will execute the action.
   * @member {number} [trigger.lifetimePercentage] Percentage of lifetime at
   * which to trigger. Value should be between 1 and 99.
   * @member {number} [trigger.daysBeforeExpiry] Days before expiry to attempt
   * renewal. Value should be between 1 and validity_in_months multiplied by
   * 27. If validity_in_months is 36, then value should be between 1 and 972
   * (36 * 27).
   * @member {object} [action] The action that will be executed.
   * @member {string} [action.actionType] The type of the action. Possible
   * values include: 'EmailContacts', 'AutoRenew'
   */
  constructor() {
  }

  /**
   * Defines the metadata of LifetimeAction
   *
   * @returns {object} metadata of LifetimeAction
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'LifetimeAction',
      type: {
        name: 'Composite',
        className: 'LifetimeAction',
        modelProperties: {
          trigger: {
            required: false,
            serializedName: 'trigger',
            type: {
              name: 'Composite',
              className: 'Trigger'
            }
          },
          action: {
            required: false,
            serializedName: 'action',
            type: {
              name: 'Composite',
              className: 'Action'
            }
          }
        }
      }
    };
  }
}

module.exports = LifetimeAction;
