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

/**
 * Management policy for a certificate.
 *
 */
class CertificatePolicy {
  /**
   * Create a CertificatePolicy.
   * @member {string} [id] The certificate id.
   * @member {object} [keyProperties] Properties of the key backing a
   * certificate.
   * @member {boolean} [keyProperties.exportable] Indicates if the private key
   * can be exported.
   * @member {string} [keyProperties.keyType] The type of key pair to be used
   * for the certificate. Possible values include: 'EC', 'EC-HSM', 'RSA',
   * 'RSA-HSM', 'oct'
   * @member {number} [keyProperties.keySize] The key size in bits. For
   * example: 2048, 3072, or 4096 for RSA.
   * @member {boolean} [keyProperties.reuseKey] Indicates if the same key pair
   * will be used on certificate renewal.
   * @member {string} [keyProperties.curve] Elliptic curve name. For valid
   * values, see JsonWebKeyCurveName. Possible values include: 'P-256',
   * 'P-384', 'P-521', 'P-256K'
   * @member {object} [secretProperties] Properties of the secret backing a
   * certificate.
   * @member {string} [secretProperties.contentType] The media type (MIME
   * type).
   * @member {object} [x509CertificateProperties] Properties of the X509
   * component of a certificate.
   * @member {string} [x509CertificateProperties.subject] The subject name.
   * Should be a valid X509 distinguished Name.
   * @member {array} [x509CertificateProperties.ekus] The enhanced key usage.
   * @member {object} [x509CertificateProperties.subjectAlternativeNames] The
   * subject alternative names.
   * @member {array} [x509CertificateProperties.subjectAlternativeNames.emails]
   * Email addresses.
   * @member {array}
   * [x509CertificateProperties.subjectAlternativeNames.dnsNames] Domain names.
   * @member {array} [x509CertificateProperties.subjectAlternativeNames.upns]
   * User principal names.
   * @member {array} [x509CertificateProperties.keyUsage] List of key usages.
   * @member {number} [x509CertificateProperties.validityInMonths] The duration
   * that the ceritifcate is valid in months.
   * @member {array} [lifetimeActions] Actions that will be performed by Key
   * Vault over the lifetime of a certificate.
   * @member {object} [issuerParameters] Parameters for the issuer of the X509
   * component of a certificate.
   * @member {string} [issuerParameters.name] Name of the referenced issuer
   * object or reserved names; for example, 'Self' or 'Unknown'.
   * @member {string} [issuerParameters.certificateType] Type of certificate to
   * be requested from the issuer provider.
   * @member {boolean} [issuerParameters.certificateTransparency] Indicates if
   * the certificates generated under this policy should be published to
   * certificate transparency logs.
   * @member {object} [attributes] The certificate attributes.
   * @member {string} [attributes.recoveryLevel] Reflects the deletion recovery
   * level currently in effect for certificates in the current vault. If it
   * contains 'Purgeable', the certificate can be permanently deleted by a
   * privileged user; otherwise, only the system can purge the certificate, at
   * the end of the retention interval. Possible values include: 'Purgeable',
   * 'Recoverable+Purgeable', 'Recoverable',
   * 'Recoverable+ProtectedSubscription'
   */
  constructor() {
  }

  /**
   * Defines the metadata of CertificatePolicy
   *
   * @returns {object} metadata of CertificatePolicy
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'CertificatePolicy',
      type: {
        name: 'Composite',
        className: 'CertificatePolicy',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          keyProperties: {
            required: false,
            serializedName: 'key_props',
            type: {
              name: 'Composite',
              className: 'KeyProperties'
            }
          },
          secretProperties: {
            required: false,
            serializedName: 'secret_props',
            type: {
              name: 'Composite',
              className: 'SecretProperties'
            }
          },
          x509CertificateProperties: {
            required: false,
            serializedName: 'x509_props',
            type: {
              name: 'Composite',
              className: 'X509CertificateProperties'
            }
          },
          lifetimeActions: {
            required: false,
            serializedName: 'lifetime_actions',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'LifetimeActionElementType',
                  type: {
                    name: 'Composite',
                    className: 'LifetimeAction'
                  }
              }
            }
          },
          issuerParameters: {
            required: false,
            serializedName: 'issuer',
            type: {
              name: 'Composite',
              className: 'IssuerParameters'
            }
          },
          attributes: {
            required: false,
            serializedName: 'attributes',
            type: {
              name: 'Composite',
              className: 'CertificateAttributes'
            }
          }
        }
      }
    };
  }
}

module.exports = CertificatePolicy;
