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

/**
 * The data stored in JSON format.
 *
 * @extends models['DatasetStorageFormat']
 */
class JsonFormat extends models['DatasetStorageFormat'] {
  /**
   * Create a JsonFormat.
   * @member {string} [filePattern] File pattern of JSON. To be more specific,
   * the way of separating a collection of JSON objects. The default value is
   * 'setOfObjects'. It is case-sensitive. Possible values include:
   * 'setOfObjects', 'arrayOfObjects'
   * @member {object} [nestingSeparator] The character used to separate nesting
   * levels. Default value is '.' (dot). Type: string (or Expression with
   * resultType string).
   * @member {object} [encodingName] The code page name of the preferred
   * encoding. If not provided, the default value is 'utf-8', unless the byte
   * order mark (BOM) denotes another Unicode encoding. The full list of
   * supported values can be found in the 'Name' column of the table of
   * encodings in the following reference:
   * https://go.microsoft.com/fwlink/?linkid=861078. Type: string (or
   * Expression with resultType string).
   * @member {object} [jsonNodeReference] The JSONPath of the JSON array
   * element to be flattened. Example: "$.ArrayPath". Type: string (or
   * Expression with resultType string).
   * @member {object} [jsonPathDefinition] The JSONPath definition for each
   * column mapping with a customized column name to extract data from JSON
   * file. For fields under root object, start with "$"; for fields inside the
   * array chosen by jsonNodeReference property, start from the array element.
   * Example: {"Column1": "$.Column1Path", "Column2": "Column2PathInArray"}.
   * Type: object (or Expression with resultType object).
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of JsonFormat
   *
   * @returns {object} metadata of JsonFormat
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'JsonFormat',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'type',
          clientName: 'type'
        },
        uberParent: 'DatasetStorageFormat',
        className: 'JsonFormat',
        modelProperties: {
          serializer: {
            required: false,
            serializedName: 'serializer',
            type: {
              name: 'Object'
            }
          },
          deserializer: {
            required: false,
            serializedName: 'deserializer',
            type: {
              name: 'Object'
            }
          },
          type: {
            required: true,
            serializedName: 'type',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          filePattern: {
            required: false,
            serializedName: 'filePattern',
            type: {
              name: 'String'
            }
          },
          nestingSeparator: {
            required: false,
            serializedName: 'nestingSeparator',
            type: {
              name: 'Object'
            }
          },
          encodingName: {
            required: false,
            serializedName: 'encodingName',
            type: {
              name: 'Object'
            }
          },
          jsonNodeReference: {
            required: false,
            serializedName: 'jsonNodeReference',
            type: {
              name: 'Object'
            }
          },
          jsonPathDefinition: {
            required: false,
            serializedName: 'jsonPathDefinition',
            type: {
              name: 'Object'
            }
          }
        }
      }
    };
  }
}

module.exports = JsonFormat;
