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

/**
 * A managed server security alert policy.
 *
 * @extends models['ProxyResource']
 */
class ManagedServerSecurityAlertPolicy extends models['ProxyResource'] {
  /**
   * Create a ManagedServerSecurityAlertPolicy.
   * @property {string} state Specifies the state of the policy, whether it is
   * enabled or disabled or a policy has not been applied yet on the specific
   * database. Possible values include: 'New', 'Enabled', 'Disabled'
   * @property {array} [disabledAlerts] Specifies an array of alerts that are
   * disabled. Allowed values are: Sql_Injection, Sql_Injection_Vulnerability,
   * Access_Anomaly, Data_Exfiltration, Unsafe_Action
   * @property {array} [emailAddresses] Specifies an array of e-mail addresses
   * to which the alert is sent.
   * @property {boolean} [emailAccountAdmins] Specifies that the alert is sent
   * to the account administrators.
   * @property {string} [storageEndpoint] Specifies the blob storage endpoint
   * (e.g. https://MyAccount.blob.core.windows.net). This blob storage will
   * hold all Threat Detection audit logs.
   * @property {string} [storageAccountAccessKey] Specifies the identifier key
   * of the Threat Detection audit storage account.
   * @property {number} [retentionDays] Specifies the number of days to keep in
   * the Threat Detection audit logs.
   * @property {date} [creationTime] Specifies the UTC creation time of the
   * policy.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ManagedServerSecurityAlertPolicy
   *
   * @returns {object} metadata of ManagedServerSecurityAlertPolicy
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ManagedServerSecurityAlertPolicy',
      type: {
        name: 'Composite',
        className: 'ManagedServerSecurityAlertPolicy',
        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'
            }
          },
          state: {
            required: true,
            serializedName: 'properties.state',
            type: {
              name: 'Enum',
              allowedValues: [ 'New', 'Enabled', 'Disabled' ]
            }
          },
          disabledAlerts: {
            required: false,
            serializedName: 'properties.disabledAlerts',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          emailAddresses: {
            required: false,
            serializedName: 'properties.emailAddresses',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          emailAccountAdmins: {
            required: false,
            serializedName: 'properties.emailAccountAdmins',
            type: {
              name: 'Boolean'
            }
          },
          storageEndpoint: {
            required: false,
            serializedName: 'properties.storageEndpoint',
            type: {
              name: 'String'
            }
          },
          storageAccountAccessKey: {
            required: false,
            serializedName: 'properties.storageAccountAccessKey',
            type: {
              name: 'String'
            }
          },
          retentionDays: {
            required: false,
            serializedName: 'properties.retentionDays',
            type: {
              name: 'Number'
            }
          },
          creationTime: {
            required: false,
            readOnly: true,
            serializedName: 'properties.creationTime',
            type: {
              name: 'DateTime'
            }
          }
        }
      }
    };
  }
}

module.exports = ManagedServerSecurityAlertPolicy;
