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

/**
 * Web activity.
 *
 * @extends models['ExecutionActivity']
 */
class WebActivity extends models['ExecutionActivity'] {
  /**
   * Create a WebActivity.
   * @member {string} method Rest API method for target endpoint. Possible
   * values include: 'GET', 'POST', 'PUT', 'DELETE'
   * @member {object} url Web activity target endpoint and path. Type: string
   * (or Expression with resultType string).
   * @member {object} [headers] Represents the headers that will be sent to the
   * request. For example, to set the language and type on a request: "headers"
   * : { "Accept-Language": "en-us", "Content-Type": "application/json" }.
   * Type: string (or Expression with resultType string).
   * @member {object} [body] Represents the payload that will be sent to the
   * endpoint. Required for POST/PUT method, not allowed for GET method Type:
   * string (or Expression with resultType string).
   * @member {object} [authentication] Authentication method used for calling
   * the endpoint.
   * @member {string} [authentication.type] Web activity authentication
   * (Basic/ClientCertificate/MSI)
   * @member {object} [authentication.pfx] Base64-encoded contents of a PFX
   * file.
   * @member {string} [authentication.pfx.value] Value of secure string.
   * @member {string} [authentication.username] Web activity authentication
   * user name for basic authentication.
   * @member {object} [authentication.password] Password for the PFX file or
   * basic authentication.
   * @member {string} [authentication.password.value] Value of secure string.
   * @member {string} [authentication.resource] Resource for which Azure Auth
   * token will be requested when using MSI Authentication.
   * @member {array} [datasets] List of datasets passed to web endpoint.
   * @member {array} [linkedServices] List of linked services passed to web
   * endpoint.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of WebActivity
   *
   * @returns {object} metadata of WebActivity
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'WebActivity',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'Activity',
        className: 'WebActivity',
        modelProperties: {
          name: {
            required: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          description: {
            required: false,
            serializedName: 'description',
            type: {
              name: 'String'
            }
          },
          dependsOn: {
            required: false,
            serializedName: 'dependsOn',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'ActivityDependencyElementType',
                  type: {
                    name: 'Composite',
                    additionalProperties: {
                      type: {
                        name: 'Dictionary',
                        value: {
                            required: false,
                            serializedName: 'ObjectElementType',
                            type: {
                              name: 'Object'
                            }
                        }
                      }
                    },
                    className: 'ActivityDependency'
                  }
              }
            }
          },
          userProperties: {
            required: false,
            serializedName: 'userProperties',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'UserPropertyElementType',
                  type: {
                    name: 'Composite',
                    className: 'UserProperty'
                  }
              }
            }
          },
          type: {
            required: true,
            serializedName: 'type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          linkedServiceName: {
            required: false,
            serializedName: 'linkedServiceName',
            type: {
              name: 'Composite',
              className: 'LinkedServiceReference'
            }
          },
          policy: {
            required: false,
            serializedName: 'policy',
            type: {
              name: 'Composite',
              additionalProperties: {
                type: {
                  name: 'Dictionary',
                  value: {
                      required: false,
                      serializedName: 'ObjectElementType',
                      type: {
                        name: 'Object'
                      }
                  }
                }
              },
              className: 'ActivityPolicy'
            }
          },
          method: {
            required: true,
            serializedName: 'typeProperties.method',
            type: {
              name: 'String'
            }
          },
          url: {
            required: true,
            serializedName: 'typeProperties.url',
            type: {
              name: 'Object'
            }
          },
          headers: {
            required: false,
            serializedName: 'typeProperties.headers',
            type: {
              name: 'Object'
            }
          },
          body: {
            required: false,
            serializedName: 'typeProperties.body',
            type: {
              name: 'Object'
            }
          },
          authentication: {
            required: false,
            serializedName: 'typeProperties.authentication',
            type: {
              name: 'Composite',
              className: 'WebActivityAuthentication'
            }
          },
          datasets: {
            required: false,
            serializedName: 'typeProperties.datasets',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'DatasetReferenceElementType',
                  type: {
                    name: 'Composite',
                    className: 'DatasetReference'
                  }
              }
            }
          },
          linkedServices: {
            required: false,
            serializedName: 'typeProperties.linkedServices',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'LinkedServiceReferenceElementType',
                  type: {
                    name: 'Composite',
                    className: 'LinkedServiceReference'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = WebActivity;
