/*
 * 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 binding to a JavaScript function.
 *
 * @extends models['FunctionBinding']
 */
class JavaScriptFunctionBinding extends models['FunctionBinding'] {
  /**
   * Create a JavaScriptFunctionBinding.
   * @member {string} [script] The JavaScript code containing a single function
   * definition. For example: 'function (x, y) { return x + y; }'
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of JavaScriptFunctionBinding
   *
   * @returns {object} metadata of JavaScriptFunctionBinding
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'Microsoft.StreamAnalytics/JavascriptUdf',
      type: {
        name: 'Composite',
        className: 'JavaScriptFunctionBinding',
        modelProperties: {
          type: {
            required: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          script: {
            required: false,
            serializedName: 'properties.script',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = JavaScriptFunctionBinding;
