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

/**
 * Class representing a OAuth2.
 */
class OAuth2 {
  /**
   * Create a OAuth2.
   * @member {string} [odatatype]
   * Microsoft.DirectoryServices.OAuth2PermissionGrant
   * @member {string} [clientId] The objectId of the Service Principal
   * associated with the app
   * @member {string} [consentType] Typically set to AllPrincipals
   * @member {object} [principalId] Set to null if AllPrincipals is set
   * @member {string} [resourceId] Service Principal Id of the resource you
   * want to grant
   * @member {string} [scope] Typically set to user_impersonation
   * @member {string} [startTime] Start time for TTL
   * @member {string} [expiryTime] Expiry time for TTL
   */
  constructor() {
  }

  /**
   * Defines the metadata of OAuth2
   *
   * @returns {object} metadata of OAuth2
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'OAuth2',
      type: {
        name: 'Composite',
        className: 'OAuth2',
        modelProperties: {
          odatatype: {
            required: false,
            serializedName: 'odata\\.type',
            type: {
              name: 'String'
            }
          },
          clientId: {
            required: false,
            serializedName: 'clientId',
            type: {
              name: 'String'
            }
          },
          consentType: {
            required: false,
            serializedName: 'consentType',
            type: {
              name: 'String'
            }
          },
          principalId: {
            required: false,
            serializedName: 'principalId',
            type: {
              name: 'Object'
            }
          },
          resourceId: {
            required: false,
            serializedName: 'resourceId',
            type: {
              name: 'String'
            }
          },
          scope: {
            required: false,
            serializedName: 'scope',
            type: {
              name: 'String'
            }
          },
          startTime: {
            required: false,
            serializedName: 'startTime',
            type: {
              name: 'String'
            }
          },
          expiryTime: {
            required: false,
            serializedName: 'expiryTime',
            type: {
              name: 'String'
            }
          }
        }
      }
    };
  }
}

module.exports = OAuth2;
