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

/**
 * Describes a DocumentDB output data source.
 *
 * @extends models['OutputDataSource']
 */
class DocumentDbOutputDataSource extends models['OutputDataSource'] {
  /**
   * Create a DocumentDbOutputDataSource.
   * @member {string} [accountId] The DocumentDB account name or ID. Required
   * on PUT (CreateOrReplace) requests.
   * @member {string} [accountKey] The account key for the DocumentDB account.
   * Required on PUT (CreateOrReplace) requests.
   * @member {string} [database] The name of the DocumentDB database. Required
   * on PUT (CreateOrReplace) requests.
   * @member {string} [collectionNamePattern] The collection name pattern for
   * the collections to be used. The collection name format can be constructed
   * using the optional {partition} token, where partitions start from 0. See
   * the DocumentDB section of
   * https://docs.microsoft.com/en-us/rest/api/streamanalytics/stream-analytics-output
   * for more information. Required on PUT (CreateOrReplace) requests.
   * @member {string} [partitionKey] The name of the field in output events
   * used to specify the key for partitioning output across collections. If
   * 'collectionNamePattern' contains the {partition} token, this property is
   * required to be specified.
   * @member {string} [documentId] The name of the field in output events used
   * to specify the primary key which insert or update operations are based on.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of DocumentDbOutputDataSource
   *
   * @returns {object} metadata of DocumentDbOutputDataSource
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.Storage/DocumentDB',
      type: {
        name: 'Composite',
        className: 'DocumentDbOutputDataSource',
        modelProperties: {
          type: {
            required: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          accountId: {
            required: false,
            serializedName: 'properties.accountId',
            type: {
              name: 'String'
            }
          },
          accountKey: {
            required: false,
            serializedName: 'properties.accountKey',
            type: {
              name: 'String'
            }
          },
          database: {
            required: false,
            serializedName: 'properties.database',
            type: {
              name: 'String'
            }
          },
          collectionNamePattern: {
            required: false,
            serializedName: 'properties.collectionNamePattern',
            type: {
              name: 'String'
            }
          },
          partitionKey: {
            required: false,
            serializedName: 'properties.partitionKey',
            type: {
              name: 'String'
            }
          },
          documentId: {
            required: false,
            serializedName: 'properties.documentId',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = DocumentDbOutputDataSource;
