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

/**
 * Properties of the X509 component of a certificate.
 *
 */
class X509CertificateProperties {
  /**
   * Create a X509CertificateProperties.
   * @member {string} [subject] The subject name. Should be a valid X509
   * distinguished Name.
   * @member {array} [ekus] The enhanced key usage.
   * @member {object} [subjectAlternativeNames] The subject alternative names.
   * @member {array} [subjectAlternativeNames.emails] Email addresses.
   * @member {array} [subjectAlternativeNames.dnsNames] Domain names.
   * @member {array} [subjectAlternativeNames.upns] User principal names.
   * @member {array} [keyUsage] List of key usages.
   * @member {number} [validityInMonths] The duration that the ceritifcate is
   * valid in months.
   */
  constructor() {
  }

  /**
   * Defines the metadata of X509CertificateProperties
   *
   * @returns {object} metadata of X509CertificateProperties
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'X509CertificateProperties',
      type: {
        name: 'Composite',
        className: 'X509CertificateProperties',
        modelProperties: {
          subject: {
            required: false,
            serializedName: 'subject',
            type: {
              name: 'String'
            }
          },
          ekus: {
            required: false,
            serializedName: 'ekus',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          subjectAlternativeNames: {
            required: false,
            serializedName: 'sans',
            type: {
              name: 'Composite',
              className: 'SubjectAlternativeNames'
            }
          },
          keyUsage: {
            required: false,
            serializedName: 'key_usage',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          validityInMonths: {
            required: false,
            serializedName: 'validity_months',
            constraints: {
              InclusiveMinimum: 0
            },
            type: {
              name: 'Number'
            }
          }
        }
      }
    };
  }
}

module.exports = X509CertificateProperties;
