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

/**
 * User details.
 *
 * @extends models['Resource']
 */
class UserContract extends models['Resource'] {
  /**
   * Create a UserContract.
   * @property {string} [state] Account state. Specifies whether the user is
   * active or not. Blocked users are unable to sign into the developer portal
   * or call any APIs of subscribed products. Default state is Active. Possible
   * values include: 'active', 'blocked', 'pending', 'deleted'. Default value:
   * 'active' .
   * @property {string} [note] Optional note about a user set by the
   * administrator.
   * @property {array} [identities] Collection of user identities.
   * @property {string} [firstName] First name.
   * @property {string} [lastName] Last name.
   * @property {string} [email] Email address.
   * @property {date} [registrationDate] Date of user registration. The date
   * conforms to the following format: `yyyy-MM-ddTHH:mm:ssZ` as specified by
   * the ISO 8601 standard.
   * @property {array} [groups] Collection of groups user is part of.
   */
  constructor() {
    super();
  }

  /**
   * Defines the metadata of UserContract
   *
   * @returns {object} metadata of UserContract
   *
   */
  mapper() {
    return {
      required: false,
      serializedName: 'UserContract',
      type: {
        name: 'Composite',
        className: 'UserContract',
        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: false,
            serializedName: 'properties.state',
            defaultValue: 'active',
            type: {
              name: 'String'
            }
          },
          note: {
            required: false,
            serializedName: 'properties.note',
            type: {
              name: 'String'
            }
          },
          identities: {
            required: false,
            serializedName: 'properties.identities',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'UserIdentityContractElementType',
                  type: {
                    name: 'Composite',
                    className: 'UserIdentityContract'
                  }
              }
            }
          },
          firstName: {
            required: false,
            serializedName: 'properties.firstName',
            type: {
              name: 'String'
            }
          },
          lastName: {
            required: false,
            serializedName: 'properties.lastName',
            type: {
              name: 'String'
            }
          },
          email: {
            required: false,
            serializedName: 'properties.email',
            type: {
              name: 'String'
            }
          },
          registrationDate: {
            required: false,
            serializedName: 'properties.registrationDate',
            type: {
              name: 'DateTime'
            }
          },
          groups: {
            required: false,
            readOnly: true,
            serializedName: 'properties.groups',
            type: {
              name: 'Sequence',
              element: {
                  required: false,
                  serializedName: 'GroupContractPropertiesElementType',
                  type: {
                    name: 'Composite',
                    className: 'GroupContractProperties'
                  }
              }
            }
          }
        }
      }
    };
  }
}

module.exports = UserContract;
