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

/**
 * Api Entity Properties
 *
 * @extends models['ApiEntityBaseContract']
 */
class ApiContractProperties extends models['ApiEntityBaseContract'] {
  /**
   * Create a ApiContractProperties.
   * @property {string} [sourceApiId] API identifier of the source API.
   * @property {string} [displayName] API name. Must be 1 to 300 characters
   * long.
   * @property {string} [serviceUrl] Absolute URL of the backend service
   * implementing this API. Cannot be more than 2000 characters long.
   * @property {string} path Relative URL uniquely identifying this API and all
   * of its resource paths within the API Management service instance. It is
   * appended to the API endpoint base URL specified during the service
   * instance creation to form a public URL for this API.
   * @property {array} [protocols] Describes on which protocols the operations
   * in this API can be invoked.
   * @property {object} [apiVersionSet] Version set details
   * @property {string} [apiVersionSet.id] Identifier for existing API Version
   * Set. Omit this value to create a new Version Set.
   * @property {string} [apiVersionSet.name] The display Name of the API
   * Version Set.
   * @property {string} [apiVersionSet.description] Description of API Version
   * Set.
   * @property {string} [apiVersionSet.versioningScheme] An value that
   * determines where the API Version identifer will be located in a HTTP
   * request. Possible values include: 'Segment', 'Query', 'Header'
   * @property {string} [apiVersionSet.versionQueryName] Name of query
   * parameter that indicates the API Version if versioningScheme is set to
   * `query`.
   * @property {string} [apiVersionSet.versionHeaderName] Name of HTTP header
   * parameter that indicates the API Version if versioningScheme is set to
   * `header`.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ApiContractProperties
   *
   * @returns {object} metadata of ApiContractProperties
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ApiContractProperties',
      type: {
        name: 'Composite',
        className: 'ApiContractProperties',
        modelProperties: {
          description: {
            required: false,
            serializedName: 'description',
            type: {
              name: 'String'
            }
          },
          authenticationSettings: {
            required: false,
            serializedName: 'authenticationSettings',
            type: {
              name: 'Composite',
              className: 'AuthenticationSettingsContract'
            }
          },
          subscriptionKeyParameterNames: {
            required: false,
            serializedName: 'subscriptionKeyParameterNames',
            type: {
              name: 'Composite',
              className: 'SubscriptionKeyParameterNamesContract'
            }
          },
          apiType: {
            required: false,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          apiRevision: {
            required: false,
            serializedName: 'apiRevision',
            constraints: {
              MaxLength: 100,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          apiVersion: {
            required: false,
            serializedName: 'apiVersion',
            constraints: {
              MaxLength: 100
            },
            type: {
              name: 'String'
            }
          },
          isCurrent: {
            required: false,
            serializedName: 'isCurrent',
            type: {
              name: 'Boolean'
            }
          },
          isOnline: {
            required: false,
            readOnly: true,
            serializedName: 'isOnline',
            type: {
              name: 'Boolean'
            }
          },
          apiRevisionDescription: {
            required: false,
            serializedName: 'apiRevisionDescription',
            constraints: {
              MaxLength: 256
            },
            type: {
              name: 'String'
            }
          },
          apiVersionDescription: {
            required: false,
            serializedName: 'apiVersionDescription',
            constraints: {
              MaxLength: 256
            },
            type: {
              name: 'String'
            }
          },
          apiVersionSetId: {
            required: false,
            serializedName: 'apiVersionSetId',
            type: {
              name: 'String'
            }
          },
          subscriptionRequired: {
            required: false,
            serializedName: 'subscriptionRequired',
            type: {
              name: 'Boolean'
            }
          },
          sourceApiId: {
            required: false,
            serializedName: 'sourceApiId',
            type: {
              name: 'String'
            }
          },
          displayName: {
            required: false,
            serializedName: 'displayName',
            constraints: {
              MaxLength: 300,
              MinLength: 1
            },
            type: {
              name: 'String'
            }
          },
          serviceUrl: {
            required: false,
            serializedName: 'serviceUrl',
            constraints: {
              MaxLength: 2000,
              MinLength: 0
            },
            type: {
              name: 'String'
            }
          },
          path: {
            required: true,
            serializedName: 'path',
            constraints: {
              MaxLength: 400,
              MinLength: 0
            },
            type: {
              name: 'String'
            }
          },
          protocols: {
            required: false,
            serializedName: 'protocols',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ProtocolElementType',
                  type: {
                    name: 'Enum',
                    allowedValues: [ 'http', 'https' ]
                  }
              }
            }
          },
          apiVersionSet: {
            required: false,
            serializedName: 'apiVersionSet',
            type: {
              name: 'Composite',
              className: 'ApiVersionSetContractDetails'
            }
          }
        }
      }
    };
  }
}

module.exports = ApiContractProperties;
