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

/**
 * Contains information about a certificate.
 *
 * @extends models['ProxyResource']
 */
class Certificate extends models['ProxyResource'] {
  /**
   * Create a Certificate.
   * @property {string} [thumbprintAlgorithm] The algorithm of the certificate
   * thumbprint. This must match the first portion of the certificate name.
   * Currently required to be 'SHA1'.
   * @property {string} [thumbprint] The thumbprint of the certificate. This
   * must match the thumbprint from the name.
   * @property {string} [format] The format of the certificate - either Pfx or
   * Cer. If omitted, the default is Pfx. Possible values include: 'Pfx', 'Cer'
   * @property {string} [provisioningState] The provisioned state of the
   * resource. Possible values include: 'Succeeded', 'Deleting', 'Failed'
   * @property {date} [provisioningStateTransitionTime] The time at which the
   * certificate entered its current state.
   * @property {string} [previousProvisioningState] The previous provisioned
   * state of the resource. Possible values include: 'Succeeded', 'Deleting',
   * 'Failed'
   * @property {date} [previousProvisioningStateTransitionTime] The time at
   * which the certificate entered its previous state.
   * @property {string} [publicData] The public key of the certificate.
   * @property {object} [deleteCertificateError] The error which occurred while
   * deleting the certificate. This is only returned when the certificate
   * provisioningState is 'Failed'.
   * @property {string} [deleteCertificateError.code] An identifier for the
   * error. Codes are invariant and are intended to be consumed
   * programmatically.
   * @property {string} [deleteCertificateError.message] A message describing
   * the error, intended to be suitable for display in a user interface.
   * @property {string} [deleteCertificateError.target] The target of the
   * particular error. For example, the name of the property in error.
   * @property {array} [deleteCertificateError.details] A list of additional
   * details about the error.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Certificate
   *
   * @returns {object} metadata of Certificate
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Certificate',
      type: {
        name: 'Composite',
        className: 'Certificate',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          etag: {
            required: false,
            readOnly: true,
            serializedName: 'etag',
            type: {
              name: 'String'
            }
          },
          thumbprintAlgorithm: {
            required: false,
            serializedName: 'properties.thumbprintAlgorithm',
            type: {
              name: 'String'
            }
          },
          thumbprint: {
            required: false,
            serializedName: 'properties.thumbprint',
            type: {
              name: 'String'
            }
          },
          format: {
            required: false,
            nullable: false,
            serializedName: 'properties.format',
            type: {
              name: 'Enum',
              allowedValues: [ 'Pfx', 'Cer' ]
            }
          },
          provisioningState: {
            required: false,
            nullable: false,
            readOnly: true,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'Enum',
              allowedValues: [ 'Succeeded', 'Deleting', 'Failed' ]
            }
          },
          provisioningStateTransitionTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.provisioningStateTransitionTime',
            type: {
              name: 'DateTime'
            }
          },
          previousProvisioningState: {
            required: false,
            nullable: false,
            readOnly: true,
            serializedName: 'properties.previousProvisioningState',
            type: {
              name: 'Enum',
              allowedValues: [ 'Succeeded', 'Deleting', 'Failed' ]
            }
          },
          previousProvisioningStateTransitionTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.previousProvisioningStateTransitionTime',
            type: {
              name: 'DateTime'
            }
          },
          publicData: {
            required: false,
            readOnly: true,
            serializedName: 'properties.publicData',
            type: {
              name: 'String'
            }
          },
          deleteCertificateError: {
            required: false,
            readOnly: true,
            serializedName: 'properties.deleteCertificateError',
            type: {
              name: 'Composite',
              className: 'DeleteCertificateError'
            }
          }
        }
      }
    };
  }
}

module.exports = Certificate;
