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

/**
 * Backend details.
 *
 * @extends models['Resource']
 */
class BackendContract extends models['Resource'] {
  /**
   * Create a BackendContract.
   * @property {string} [title] Backend Title.
   * @property {string} [description] Backend Description.
   * @property {string} [resourceId] Management Uri of the Resource in External
   * System. This url can be the Arm Resource Id of Logic Apps, Function Apps
   * or Api Apps.
   * @property {object} [properties] Backend Properties contract
   * @property {object} [properties.serviceFabricCluster] Backend Service
   * Fabric Cluster Properties
   * @property {string}
   * [properties.serviceFabricCluster.clientCertificatethumbprint] The client
   * certificate thumbprint for the management endpoint.
   * @property {number}
   * [properties.serviceFabricCluster.maxPartitionResolutionRetries] Maximum
   * number of retries while attempting resolve the partition.
   * @property {array} [properties.serviceFabricCluster.managementEndpoints]
   * The cluster management endpoint.
   * @property {array}
   * [properties.serviceFabricCluster.serverCertificateThumbprints] Thumbprints
   * of certificates cluster management service uses for tls communication
   * @property {array} [properties.serviceFabricCluster.serverX509Names] Server
   * X509 Certificate Names Collection
   * @property {object} [credentials] Backend Credentials Contract Properties
   * @property {array} [credentials.certificate] List of Client Certificate
   * Thumbprint.
   * @property {object} [credentials.query] Query Parameter description.
   * @property {object} [credentials.header] Header Parameter description.
   * @property {object} [credentials.authorization] Authorization header
   * authentication
   * @property {string} [credentials.authorization.scheme] Authentication
   * Scheme name.
   * @property {string} [credentials.authorization.parameter] Authentication
   * Parameter value.
   * @property {object} [proxy] Backend Proxy Contract Properties
   * @property {string} [proxy.url] WebProxy Server AbsoluteUri property which
   * includes the entire URI stored in the Uri instance, including all
   * fragments and query strings.
   * @property {string} [proxy.username] Username to connect to the WebProxy
   * server
   * @property {string} [proxy.password] Password to connect to the WebProxy
   * Server
   * @property {object} [tls] Backend TLS Properties
   * @property {boolean} [tls.validateCertificateChain] Flag indicating whether
   * SSL certificate chain validation should be done when using self-signed
   * certificates for this backend host.
   * @property {boolean} [tls.validateCertificateName] Flag indicating whether
   * SSL certificate name validation should be done when using self-signed
   * certificates for this backend host.
   * @property {string} url Runtime Url of the Backend.
   * @property {string} protocol Backend communication protocol. Possible
   * values include: 'http', 'soap'
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of BackendContract
   *
   * @returns {object} metadata of BackendContract
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'BackendContract',
      type: {
        name: 'Composite',
        className: 'BackendContract',
        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'
            }
          },
          title: {
            required: false,
            serializedName: 'properties.title',
            constraints: {
              MaxLength: 300,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          description: {
            required: false,
            serializedName: 'properties.description',
            constraints: {
              MaxLength: 2000,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          resourceId: {
            required: false,
            serializedName: 'properties.resourceId',
            constraints: {
              MaxLength: 2000,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          properties: {
            required: false,
            serializedName: 'properties.properties',
            type: {
              name: 'Composite',
              className: 'BackendProperties'
            }
          },
          credentials: {
            required: false,
            serializedName: 'properties.credentials',
            type: {
              name: 'Composite',
              className: 'BackendCredentialsContract'
            }
          },
          proxy: {
            required: false,
            serializedName: 'properties.proxy',
            type: {
              name: 'Composite',
              className: 'BackendProxyContract'
            }
          },
          tls: {
            required: false,
            serializedName: 'properties.tls',
            type: {
              name: 'Composite',
              className: 'BackendTlsProperties'
            }
          },
          url: {
            required: true,
            serializedName: 'properties.url',
            constraints: {
              MaxLength: 2000,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          protocol: {
            required: true,
            serializedName: 'properties.protocol',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = BackendContract;
