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

/**
 * Definition of the webhook type.
 *
 * @extends models['ProxyResource']
 */
class Webhook extends models['ProxyResource'] {
  /**
   * Create a Webhook.
   * @member {boolean} [isEnabled] Gets or sets the value of the enabled flag
   * of the webhook. Default value: false .
   * @member {string} [uri] Gets or sets the webhook uri.
   * @member {date} [expiryTime] Gets or sets the expiry time.
   * @member {date} [lastInvokedTime] Gets or sets the last invoked time.
   * @member {object} [parameters] Gets or sets the parameters of the job that
   * is created when the webhook calls the runbook it is associated with.
   * @member {object} [runbook] Gets or sets the runbook the webhook is
   * associated with.
   * @member {string} [runbook.name] Gets or sets the name of the runbook.
   * @member {string} [runOn] Gets or sets the name of the hybrid worker group
   * the webhook job will run on.
   * @member {date} [creationTime] Gets or sets the creation time.
   * @member {date} [lastModifiedTime] Gets or sets the last modified time.
   * @member {string} [lastModifiedBy] Details of the user who last modified
   * the Webhook
   * @member {string} [description] Gets or sets the description.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of Webhook
   *
   * @returns {object} metadata of Webhook
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Webhook',
      type: {
        name: 'Composite',
        className: 'Webhook',
        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'
            }
          },
          isEnabled: {
            required: false,
            serializedName: 'properties.isEnabled',
            defaultValue: false,
            type: {
              name: 'Boolean'
            }
          },
          uri: {
            required: false,
            serializedName: 'properties.uri',
            type: {
              name: 'String'
            }
          },
          expiryTime: {
            required: false,
            nullable: false,
            serializedName: 'properties.expiryTime',
            type: {
              name: 'DateTime'
            }
          },
          lastInvokedTime: {
            required: false,
            nullable: true,
            serializedName: 'properties.lastInvokedTime',
            type: {
              name: 'DateTime'
            }
          },
          parameters: {
            required: false,
            serializedName: 'properties.parameters',
            type: {
              name: 'Dictionary',
              value: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          runbook: {
            required: false,
            serializedName: 'properties.runbook',
            type: {
              name: 'Composite',
              className: 'RunbookAssociationProperty'
            }
          },
          runOn: {
            required: false,
            serializedName: 'properties.runOn',
            type: {
              name: 'String'
            }
          },
          creationTime: {
            required: false,
            nullable: false,
            serializedName: 'properties.creationTime',
            type: {
              name: 'DateTime'
            }
          },
          lastModifiedTime: {
            required: false,
            nullable: false,
            serializedName: 'properties.lastModifiedTime',
            type: {
              name: 'DateTime'
            }
          },
          lastModifiedBy: {
            required: false,
            serializedName: 'properties.lastModifiedBy',
            type: {
              name: 'String'
            }
          },
          description: {
            required: false,
            serializedName: 'properties.description',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = Webhook;
