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

var models = require('./index');

var util = require('util');

/**
 * @class
 * Initializes a new instance of the Endpoint class.
 * @constructor
 * CDN endpoint is the entity within a CDN profile containing configuration
 * information regarding caching behaviors and origins. The CDN endpoint is
 * exposed using the URL format <endpointname>.azureedge.net by default, but
 * custom domains can also be created.
 * @member {string} [hostName] The host name of the endpoint
 * {endpointName}.{DNSZone}
 * 
 * @member {string} [originHostHeader] The host header the CDN provider will
 * send along with content requests to origins. The default value is the host
 * name of the origin.
 * 
 * @member {string} [originPath] The path used for origin requests.
 * 
 * @member {array} [contentTypesToCompress] List of content types on which
 * compression will be applied. The value for the elements should be a valid
 * MIME type.
 * 
 * @member {boolean} [isCompressionEnabled] Indicates whether the compression
 * is enabled. Default value is false. If compression is enabled, the content
 * transferred from cdn endpoint to end user will be compressed. The
 * requested content must be larger than 1 byte and smaller than 1 MB.
 * 
 * @member {boolean} [isHttpAllowed] Indicates whether HTTP traffic is allowed
 * on the endpoint. Default value is true. At least one protocol (HTTP or
 * HTTPS) must be allowed.
 * 
 * @member {boolean} [isHttpsAllowed] Indicates whether https traffic is
 * allowed on the endpoint. Default value is true. At least one protocol
 * (HTTP or HTTPS) must be allowed.
 * 
 * @member {string} [queryStringCachingBehavior] Defines the query string
 * caching behavior. Possible values include: 'IgnoreQueryString',
 * 'BypassCaching', 'UseQueryString', 'NotSet'
 * 
 * @member {array} [origins] The set of origins for the CDN endpoint. When
 * multiple origins exist, the first origin will be used as primary and rest
 * will be used as failover options.
 * 
 * @member {string} [resourceState] Resource status of the endpoint. Possible
 * values include: 'Creating', 'Deleting', 'Running', 'Starting', 'Stopped',
 * 'Stopping'
 * 
 * @member {string} [provisioningState] Provisioning status of the endpoint.
 * Possible values include: 'Creating', 'Succeeded', 'Failed'
 * 
 */
function Endpoint() {
  Endpoint['super_'].call(this);
}

util.inherits(Endpoint, models['TrackedResource']);

/**
 * Defines the metadata of Endpoint
 *
 * @returns {object} metadata of Endpoint
 *
 */
Endpoint.prototype.mapper = function () {
  return {
    required: false,
    serializedName: 'Endpoint',
    type: {
      name: 'Composite',
      className: 'Endpoint',
      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'
          }
        },
        location: {
          required: true,
          serializedName: 'location',
          type: {
            name: 'String'
          }
        },
        tags: {
          required: true,
          serializedName: 'tags',
          type: {
            name: 'Dictionary',
            value: {
                required: false,
                serializedName: 'StringElementType',
                type: {
                  name: 'String'
                }
            }
          }
        },
        hostName: {
          required: false,
          readOnly: true,
          serializedName: 'properties.hostName',
          type: {
            name: 'String'
          }
        },
        originHostHeader: {
          required: false,
          serializedName: 'properties.originHostHeader',
          type: {
            name: 'String'
          }
        },
        originPath: {
          required: false,
          serializedName: 'properties.originPath',
          type: {
            name: 'String'
          }
        },
        contentTypesToCompress: {
          required: false,
          serializedName: 'properties.contentTypesToCompress',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serializedName: 'StringElementType',
                type: {
                  name: 'String'
                }
            }
          }
        },
        isCompressionEnabled: {
          required: false,
          serializedName: 'properties.isCompressionEnabled',
          type: {
            name: 'Boolean'
          }
        },
        isHttpAllowed: {
          required: false,
          serializedName: 'properties.isHttpAllowed',
          type: {
            name: 'Boolean'
          }
        },
        isHttpsAllowed: {
          required: false,
          serializedName: 'properties.isHttpsAllowed',
          type: {
            name: 'Boolean'
          }
        },
        queryStringCachingBehavior: {
          required: false,
          serializedName: 'properties.queryStringCachingBehavior',
          type: {
            name: 'Enum',
            allowedValues: [ 'IgnoreQueryString', 'BypassCaching', 'UseQueryString', 'NotSet' ]
          }
        },
        origins: {
          required: false,
          serializedName: 'properties.origins',
          type: {
            name: 'Sequence',
            element: {
                required: false,
                serializedName: 'DeepCreatedOriginElementType',
                type: {
                  name: 'Composite',
                  className: 'DeepCreatedOrigin'
                }
            }
          }
        },
        resourceState: {
          required: false,
          readOnly: true,
          serializedName: 'properties.resourceState',
          type: {
            name: 'Enum',
            allowedValues: [ 'Creating', 'Deleting', 'Running', 'Starting', 'Stopped', 'Stopping' ]
          }
        },
        provisioningState: {
          required: false,
          serializedName: 'properties.provisioningState',
          type: {
            name: 'Enum',
            allowedValues: [ 'Creating', 'Succeeded', 'Failed' ]
          }
        }
      }
    }
  };
};

module.exports = Endpoint;
