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

/**
 * A certificate operation is returned in case of asynchronous requests.
 *
 */
class CertificateOperation {
  /**
   * Create a CertificateOperation.
   * @member {string} [id] The certificate id.
   * @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 {buffer} [csr] The certificate signing request (CSR) that is being
   * used in the certificate operation.
   * @member {boolean} [cancellationRequested] Indicates if cancellation was
   * requested on the certificate operation.
   * @member {string} [status] Status of the certificate operation.
   * @member {string} [statusDetails] The status details of the certificate
   * operation.
   * @member {object} [error] Error encountered, if any, during the certificate
   * operation.
   * @member {string} [error.code] The error code.
   * @member {string} [error.message] The error message.
   * @member {object} [error.innerError]
   * @member {string} [target] Location which contains the result of the
   * certificate operation.
   * @member {string} [requestId] Identifier for the certificate operation.
   */
  constructor() {
  }

  /**
   * Defines the metadata of CertificateOperation
   *
   * @returns {object} metadata of CertificateOperation
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'CertificateOperation',
      type: {
        name: 'Composite',
        className: 'CertificateOperation',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          issuerParameters: {
            required: false,
            serializedName: 'issuer',
            type: {
              name: 'Composite',
              className: 'IssuerParameters'
            }
          },
          csr: {
            required: false,
            serializedName: 'csr',
            type: {
              name: 'ByteArray'
            }
          },
          cancellationRequested: {
            required: false,
            serializedName: 'cancellation_requested',
            type: {
              name: 'Boolean'
            }
          },
          status: {
            required: false,
            serializedName: 'status',
            type: {
              name: 'String'
            }
          },
          statusDetails: {
            required: false,
            serializedName: 'status_details',
            type: {
              name: 'String'
            }
          },
          error: {
            required: false,
            serializedName: 'error',
            type: {
              name: 'Composite',
              className: 'ErrorModel'
            }
          },
          target: {
            required: false,
            serializedName: 'target',
            type: {
              name: 'String'
            }
          },
          requestId: {
            required: false,
            serializedName: 'request_id',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = CertificateOperation;
