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

/**
 * Represents a database data masking rule.
 *
 * @extends models['ProxyResource']
 */
class DataMaskingRule extends models['ProxyResource'] {
  /**
   * Create a DataMaskingRule.
   * @property {string} [dataMaskingRuleId] The rule Id.
   * @property {string} [aliasName] The alias name. This is a legacy parameter
   * and is no longer used.
   * @property {string} [ruleState] The rule state. Used to delete a rule. To
   * delete an existing rule, specify the schemaName, tableName, columnName,
   * maskingFunction, and specify ruleState as disabled. However, if the rule
   * doesn't already exist, the rule will be created with ruleState set to
   * enabled, regardless of the provided value of ruleState. Possible values
   * include: 'Disabled', 'Enabled'
   * @property {string} schemaName The schema name on which the data masking
   * rule is applied.
   * @property {string} tableName The table name on which the data masking rule
   * is applied.
   * @property {string} columnName The column name on which the data masking
   * rule is applied.
   * @property {string} maskingFunction The masking function that is used for
   * the data masking rule. Possible values include: 'Default', 'CCN', 'Email',
   * 'Number', 'SSN', 'Text'
   * @property {string} [numberFrom] The numberFrom property of the masking
   * rule. Required if maskingFunction is set to Number, otherwise this
   * parameter will be ignored.
   * @property {string} [numberTo] The numberTo property of the data masking
   * rule. Required if maskingFunction is set to Number, otherwise this
   * parameter will be ignored.
   * @property {string} [prefixSize] If maskingFunction is set to Text, the
   * number of characters to show unmasked in the beginning of the string.
   * Otherwise, this parameter will be ignored.
   * @property {string} [suffixSize] If maskingFunction is set to Text, the
   * number of characters to show unmasked at the end of the string. Otherwise,
   * this parameter will be ignored.
   * @property {string} [replacementString] If maskingFunction is set to Text,
   * the character to use for masking the unexposed part of the string.
   * Otherwise, this parameter will be ignored.
   * @property {string} [location] The location of the data masking rule.
   * @property {string} [kind] The kind of Data Masking Rule. Metadata, used
   * for Azure portal.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of DataMaskingRule
   *
   * @returns {object} metadata of DataMaskingRule
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'DataMaskingRule',
      type: {
        name: 'Composite',
        className: 'DataMaskingRule',
        modelProperties: {
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          dataMaskingRuleId: {
            required: false,
            readOnly: true,
            serializedName: 'properties.id',
            type: {
              name: 'String'
            }
          },
          aliasName: {
            required: false,
            serializedName: 'properties.aliasName',
            type: {
              name: 'String'
            }
          },
          ruleState: {
            required: false,
            serializedName: 'properties.ruleState',
            type: {
              name: 'Enum',
              allowedValues: [ 'Disabled', 'Enabled' ]
            }
          },
          schemaName: {
            required: true,
            serializedName: 'properties.schemaName',
            type: {
              name: 'String'
            }
          },
          tableName: {
            required: true,
            serializedName: 'properties.tableName',
            type: {
              name: 'String'
            }
          },
          columnName: {
            required: true,
            serializedName: 'properties.columnName',
            type: {
              name: 'String'
            }
          },
          maskingFunction: {
            required: true,
            serializedName: 'properties.maskingFunction',
            type: {
              name: 'Enum',
              allowedValues: [ 'Default', 'CCN', 'Email', 'Number', 'SSN', 'Text' ]
            }
          },
          numberFrom: {
            required: false,
            serializedName: 'properties.numberFrom',
            type: {
              name: 'String'
            }
          },
          numberTo: {
            required: false,
            serializedName: 'properties.numberTo',
            type: {
              name: 'String'
            }
          },
          prefixSize: {
            required: false,
            serializedName: 'properties.prefixSize',
            type: {
              name: 'String'
            }
          },
          suffixSize: {
            required: false,
            serializedName: 'properties.suffixSize',
            type: {
              name: 'String'
            }
          },
          replacementString: {
            required: false,
            serializedName: 'properties.replacementString',
            type: {
              name: 'String'
            }
          },
          location: {
            required: false,
            readOnly: true,
            serializedName: 'location',
            type: {
              name: 'String'
            }
          },
          kind: {
            required: false,
            readOnly: true,
            serializedName: 'kind',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = DataMaskingRule;
