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

/**
 * Active Directory service principal information.
 *
 * @extends models['DirectoryObject']
 */
class ServicePrincipal extends models['DirectoryObject'] {
  /**
   * Create a ServicePrincipal.
   * @member {string} [displayName] The display name of the service principal.
   * @member {string} [appId] The application ID.
   * @member {array} [appRoles] The collection of application roles that an
   * application may declare. These roles can be assigned to users, groups or
   * service principals.
   * @member {array} [servicePrincipalNames] A collection of service principal
   * names.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of ServicePrincipal
   *
   * @returns {object} metadata of ServicePrincipal
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'ServicePrincipal',
      type: {
        name: 'Composite',
        polymorphicDiscriminator: {
          serializedName: 'objectType',
          clientName: 'objectType'
        },
        uberParent: 'DirectoryObject',
        className: 'ServicePrincipal',
        modelProperties: {
          objectId: {
            required: false,
            readOnly: true,
            serializedName: 'objectId',
            type: {
              name: 'String'
            }
          },
          deletionTimestamp: {
            required: false,
            readOnly: true,
            serializedName: 'deletionTimestamp',
            type: {
              name: 'DateTime'
            }
          },
          objectType: {
            required: true,
            serializedName: 'objectType',
            isPolymorphicDiscriminator: true,
            type: {
              name: 'String'
            }
          },
          displayName: {
            required: false,
            serializedName: 'displayName',
            type: {
              name: 'String'
            }
          },
          appId: {
            required: false,
            serializedName: 'appId',
            type: {
              name: 'String'
            }
          },
          appRoles: {
            required: false,
            serializedName: 'appRoles',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'AppRoleElementType',
                  type: {
                    name: 'Composite',
                    className: 'AppRole'
                  }
              }
            }
          },
          servicePrincipalNames: {
            required: false,
            serializedName: 'servicePrincipalNames',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'StringElementType',
                  type: {
                    name: 'String'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = ServicePrincipal;
