/*
 * 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 policy assignment.
 *
 * @extends models['BaseResource']
 */
class PolicyAssignment extends models['BaseResource'] {
  /**
   * Create a PolicyAssignment.
   * @property {string} [displayName] The display name of the policy
   * assignment.
   * @property {string} [policyDefinitionId] The ID of the policy definition or
   * policy set definition being assigned.
   * @property {string} [scope] The scope for the policy assignment.
   * @property {array} [notScopes] The policy's excluded scopes.
   * @property {object} [parameters] Required if a parameter is used in policy
   * rule.
   * @property {string} [description] This message will be part of response in
   * case of policy violation.
   * @property {object} [metadata] The policy assignment metadata.
   * @property {string} [id] The ID of the policy assignment.
   * @property {string} [type] The type of the policy assignment.
   * @property {string} [name] The name of the policy assignment.
   * @property {object} [sku] The policy sku. This property is optional,
   * obsolete, and will be ignored.
   * @property {string} [sku.name] The name of the policy sku. Possible values
   * are A0 and A1.
   * @property {string} [sku.tier] The policy sku tier. Possible values are
   * Free and Standard.
   * @property {string} [location] The location of the policy assignment. Only
   * required when utilizing managed identity.
   * @property {object} [identity] The managed identity associated with the
   * policy assignment.
   * @property {string} [identity.principalId] The principal ID of the resource
   * identity.
   * @property {string} [identity.tenantId] The tenant ID of the resource
   * identity.
   * @property {string} [identity.type] The identity type. Possible values
   * include: 'SystemAssigned', 'None'
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of PolicyAssignment
   *
   * @returns {object} metadata of PolicyAssignment
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'PolicyAssignment',
      type: {
        name: 'Composite',
        className: 'PolicyAssignment',
        modelProperties: {
          displayName: {
            required: false,
            serializedName: 'properties.displayName',
            type: {
              name: 'String'
            }
          },
          policyDefinitionId: {
            required: false,
            serializedName: 'properties.policyDefinitionId',
            type: {
              name: 'String'
            }
          },
          scope: {
            required: false,
            serializedName: 'properties.scope',
            type: {
              name: 'String'
            }
          },
          notScopes: {
            required: false,
            serializedName: 'properties.notScopes',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          },
          parameters: {
            required: false,
            serializedName: 'properties.parameters',
            type: {
              name: 'Object'
            }
          },
          description: {
            required: false,
            serializedName: 'properties.description',
            type: {
              name: 'String'
            }
          },
          metadata: {
            required: false,
            serializedName: 'properties.metadata',
            type: {
              name: 'Object'
            }
          },
          id: {
            required: false,
            readOnly: true,
            serializedName: 'id',
            type: {
              name: 'String'
            }
          },
          type: {
            required: false,
            readOnly: true,
            serializedName: 'type',
            type: {
              name: 'String'
            }
          },
          name: {
            required: false,
            readOnly: true,
            serializedName: 'name',
            type: {
              name: 'String'
            }
          },
          sku: {
            required: false,
            serializedName: 'sku',
            type: {
              name: 'Composite',
              className: 'PolicySku'
            }
          },
          location: {
            required: false,
            serializedName: 'location',
            type: {
              name: 'String'
            }
          },
          identity: {
            required: false,
            serializedName: 'identity',
            type: {
              name: 'Composite',
              className: 'Identity'
            }
          }
        }
      }
    };
  }
}

module.exports = PolicyAssignment;
