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

/**
 * Custom hostname configuration.
 *
 */
class HostnameConfiguration {
  /**
   * Create a HostnameConfiguration.
   * @property {string} type Hostname type. Possible values include: 'Proxy',
   * 'Portal', 'Management', 'Scm', 'DeveloperPortal'
   * @property {string} hostName Hostname to configure on the Api Management
   * service.
   * @property {string} [keyVaultId] Url to the KeyVault Secret containing the
   * Ssl Certificate. If absolute Url containing version is provided,
   * auto-update of ssl certificate will not work. This requires Api Management
   * service to be configured with MSI. The secret should be of type
   * *application/x-pkcs12*
   * @property {string} [encodedCertificate] Base64 Encoded certificate.
   * @property {string} [certificatePassword] Certificate Password.
   * @property {boolean} [defaultSslBinding] Specify true to setup the
   * certificate associated with this Hostname as the Default SSL Certificate.
   * If a client does not send the SNI header, then this will be the
   * certificate that will be challenged. The property is useful if a service
   * has multiple custom hostname enabled and it needs to decide on the default
   * ssl certificate. The setting only applied to Proxy Hostname Type. Default
   * value: false .
   * @property {boolean} [negotiateClientCertificate] Specify true to always
   * negotiate client certificate on the hostname. Default Value is false.
   * Default value: false .
   * @property {object} [certificate] Certificate information.
   * @property {date} [certificate.expiry] Expiration date of the certificate.
   * The date conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as
   * specified by the ISO 8601 standard.
   * @property {string} [certificate.thumbprint] Thumbprint of the certificate.
   * @property {string} [certificate.subject] Subject of the certificate.
   */
  constructor() {
  }

  /**
   * Defines the metadata of HostnameConfiguration
   *
   * @returns {object} metadata of HostnameConfiguration
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'HostnameConfiguration',
      type: {
        name: 'Composite',
        className: 'HostnameConfiguration',
        modelProperties: {
          type: {
            required: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          hostName: {
            required: true,
            serializedName: 'hostName',
            type: {
              name: 'String'
            }
          },
          keyVaultId: {
            required: false,
            serializedName: 'keyVaultId',
            type: {
              name: 'String'
            }
          },
          encodedCertificate: {
            required: false,
            serializedName: 'encodedCertificate',
            type: {
              name: 'String'
            }
          },
          certificatePassword: {
            required: false,
            serializedName: 'certificatePassword',
            type: {
              name: 'String'
            }
          },
          defaultSslBinding: {
            required: false,
            serializedName: 'defaultSslBinding',
            defaultValue: false,
            type: {
              name: 'Boolean'
            }
          },
          negotiateClientCertificate: {
            required: false,
            serializedName: 'negotiateClientCertificate',
            defaultValue: false,
            type: {
              name: 'Boolean'
            }
          },
          certificate: {
            required: false,
            serializedName: 'certificate',
            type: {
              name: 'Composite',
              className: 'CertificateInformation'
            }
          }
        }
      }
    };
  }
}

module.exports = HostnameConfiguration;
