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

/**
 * An Application Insights web test definition.
 *
 * @extends models['WebtestsResource']
 */
class WebTest extends models['WebtestsResource'] {
  /**
   * Create a WebTest.
   * @member {string} [kind] The kind of web test that this web test watches.
   * Choices are ping and multistep. Possible values include: 'ping',
   * 'multistep'. Default value: 'ping' .
   * @member {string} syntheticMonitorId Unique ID of this WebTest. This is
   * typically the same value as the Name field.
   * @member {string} webTestName User defined name if this WebTest.
   * @member {string} [description] Purpose/user defined descriptive test for
   * this WebTest.
   * @member {boolean} [enabled] Is the test actively being monitored.
   * @member {number} [frequency] Interval in seconds between test runs for
   * this WebTest. Default value is 300. Default value: 300 .
   * @member {number} [timeout] Seconds until this WebTest will timeout and
   * fail. Default value is 30. Default value: 30 .
   * @member {string} webTestKind The kind of web test this is, valid choices
   * are ping and multistep. Possible values include: 'ping', 'multistep'.
   * Default value: 'ping' .
   * @member {boolean} [retryEnabled] Allow for retries should this WebTest
   * fail.
   * @member {array} locations A list of where to physically run the tests from
   * to give global coverage for accessibility of your application.
   * @member {object} [configuration] An XML configuration specification for a
   * WebTest.
   * @member {string} [configuration.webTest] The XML specification of a
   * WebTest to run against an application.
   * @member {string} [provisioningState] Current state of this component,
   * whether or not is has been provisioned within the resource group it is
   * defined. Users cannot change this value but are able to read from it.
   * Values will include Succeeded, Deploying, Canceled, and Failed.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of WebTest
   *
   * @returns {object} metadata of WebTest
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'WebTest',
      type: {
        name: 'Composite',
        className: 'WebTest',
        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: false,
            serializedName: 'tags',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          kind: {
            required: false,
            serializedName: 'kind',
            defaultValue: 'ping',
            type: {
              name: 'Enum',
              allowedValues: [ 'ping', 'multistep' ]
            }
          },
          syntheticMonitorId: {
            required: true,
            serializedName: 'properties.SyntheticMonitorId',
            type: {
              name: 'String'
            }
          },
          webTestName: {
            required: true,
            serializedName: 'properties.Name',
            type: {
              name: 'String'
            }
          },
          description: {
            required: false,
            serializedName: 'properties.Description',
            type: {
              name: 'String'
            }
          },
          enabled: {
            required: false,
            serializedName: 'properties.Enabled',
            type: {
              name: 'Boolean'
            }
          },
          frequency: {
            required: false,
            serializedName: 'properties.Frequency',
            defaultValue: 300,
            type: {
              name: 'Number'
            }
          },
          timeout: {
            required: false,
            serializedName: 'properties.Timeout',
            defaultValue: 30,
            type: {
              name: 'Number'
            }
          },
          webTestKind: {
            required: true,
            serializedName: 'properties.Kind',
            defaultValue: 'ping',
            type: {
              name: 'Enum',
              allowedValues: [ 'ping', 'multistep' ]
            }
          },
          retryEnabled: {
            required: false,
            serializedName: 'properties.RetryEnabled',
            type: {
              name: 'Boolean'
            }
          },
          locations: {
            required: true,
            serializedName: 'properties.Locations',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'WebTestGeolocationElementType',
                  type: {
                    name: 'Composite',
                    className: 'WebTestGeolocation'
                  }
              }
            }
          },
          configuration: {
            required: false,
            serializedName: 'properties.Configuration',
            type: {
              name: 'Composite',
              className: 'WebTestPropertiesConfiguration'
            }
          },
          provisioningState: {
            required: false,
            readOnly: true,
            serializedName: 'properties.provisioningState',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = WebTest;
