/*
 * 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 the selected Blob container changes.
 *
 * @extends models['MultiplePipelineTrigger']
 */
class BlobTrigger extends models['MultiplePipelineTrigger'] {
  /**
   * Create a BlobTrigger.
   * @member {string} folderPath The path of the container/folder that will
   * trigger the pipeline.
   * @member {number} maxConcurrency The max number of parallel files to handle
   * when it is triggered.
   * @member {object} linkedService The Azure Storage linked service reference.
   * @member {string} [linkedService.referenceName] Reference LinkedService
   * name.
   * @member {object} [linkedService.parameters] Arguments for LinkedService.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of BlobTrigger
   *
   * @returns {object} metadata of BlobTrigger
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'BlobTrigger',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'Trigger',
        className: 'BlobTrigger',
        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'
                  }
              }
            }
          },
          folderPath: {
            required: true,
            serializedName: 'typeProperties.folderPath',
            type: {
              name: 'String'
            }
          },
          maxConcurrency: {
            required: true,
            serializedName: 'typeProperties.maxConcurrency',
            type: {
              name: 'Number'
            }
          },
          linkedService: {
            required: true,
            serializedName: 'typeProperties.linkedService',
            defaultValue: {},
            type: {
              name: 'Composite',
              className: 'LinkedServiceReference'
            }
          }
        }
      }
    };
  }
}

module.exports = BlobTrigger;
