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

/**
 * Trigger that runs everytime a Blob event occurs.
 *
 * @extends models['MultiplePipelineTrigger']
 */
class BlobEventsTrigger extends models['MultiplePipelineTrigger'] {
  /**
   * Create a BlobEventsTrigger.
   * @member {string} [blobPathBeginsWith] The blob path must begin with the
   * pattern provided for trigger to fire. For example,
   * '/records/blobs/december/' will only fire the trigger for blobs in the
   * december folder under the records container. At least one of these must be
   * provided: blobPathBeginsWith, blobPathEndsWith.
   * @member {string} [blobPathEndsWith] The blob path must end with the
   * pattern provided for trigger to fire. For example, 'december/boxes.csv'
   * will only fire the trigger for blobs named boxes in a december folder. At
   * least one of these must be provided: blobPathBeginsWith, blobPathEndsWith.
   * @member {array} events The type of events that cause this trigger to fire.
   * @member {string} scope The ARM resource ID of the Storage Account.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of BlobEventsTrigger
   *
   * @returns {object} metadata of BlobEventsTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'BlobEventsTrigger',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'Trigger',
        className: 'BlobEventsTrigger',
        modelProperties: {
          description: {
            required: false,
            serializedName: 'description',
            type: {
              name: 'String'
            }
          },
          runtimeState: {
            required: false,
            readOnly: true,
            serializedName: 'runtimeState',
            type: {
              name: 'String'
            }
          },
          type: {
            required: true,
            serializedName: 'type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          pipelines: {
            required: false,
            serializedName: 'pipelines',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'TriggerPipelineReferenceElementType',
                  type: {
                    name: 'Composite',
                    className: 'TriggerPipelineReference'
                  }
              }
            }
          },
          blobPathBeginsWith: {
            required: false,
            serializedName: 'typeProperties.blobPathBeginsWith',
            type: {
              name: 'String'
            }
          },
          blobPathEndsWith: {
            required: false,
            serializedName: 'typeProperties.blobPathEndsWith',
            type: {
              name: 'String'
            }
          },
          events: {
            required: true,
            serializedName: 'typeProperties.events',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'BlobEventTypesElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          scope: {
            required: true,
            serializedName: 'typeProperties.scope',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = BlobEventsTrigger;
