/* tslint:disable */
/* eslint-disable */
/**
 * Sonatype Nexus Repository Manager
 * This documents the available APIs into [Sonatype Nexus Repository Manager](https://www.sonatype.com/products/sonatype-nexus-repository) as of version 3.93.2-01.
 *
 * The version of the OpenAPI document: 3.93.2-01
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { mapValues } from '../runtime';
/**
 * 
 * @export
 * @interface ApiUser
 */
export interface ApiUser {
    /**
     * The email address associated with the user.
     * @type {string}
     * @memberof ApiUser
     */
    emailAddress?: string;
    /**
     * The roles which the user has been assigned in an external source, e.g. LDAP group. These cannot be changed within the Nexus Repository Manager.
     * @type {Set<string>}
     * @memberof ApiUser
     */
    externalRoles?: Set<string>;
    /**
     * The first name of the user.
     * @type {string}
     * @memberof ApiUser
     */
    firstName?: string;
    /**
     * The last name of the user.
     * @type {string}
     * @memberof ApiUser
     */
    lastName?: string;
    /**
     * Indicates whether the user's properties could be modified by the Nexus Repository Manager. When false only roles are considered during update.
     * @type {boolean}
     * @memberof ApiUser
     */
    readOnly?: boolean;
    /**
     * The roles which the user has been assigned within Nexus.
     * @type {Set<string>}
     * @memberof ApiUser
     */
    roles?: Set<string>;
    /**
     * The source of the user. When creating user, if the source is "default", the local Nexus Security User will be created. If the source is anything but "default" (i.e., LDAP or SAML), a local LdapUser (or SamlUser) will be created and have the listed roles assigned to that user.
     * @type {string}
     * @memberof ApiUser
     */
    source?: string;
    /**
     * The user's status, e.g. active or disabled.
     * @type {string}
     * @memberof ApiUser
     */
    status: ApiUserStatusEnum;
    /**
     * The userid which is required for login. This value cannot be changed.
     * @type {string}
     * @memberof ApiUser
     */
    userId?: string;
}


/**
 * @export
 */
export const ApiUserStatusEnum = {
    Active: 'active',
    Locked: 'locked',
    Disabled: 'disabled',
    Changepassword: 'changepassword'
} as const;
export type ApiUserStatusEnum = typeof ApiUserStatusEnum[keyof typeof ApiUserStatusEnum];


/**
 * Check if a given object implements the ApiUser interface.
 */
export function instanceOfApiUser(value: object): value is ApiUser {
    if (!('status' in value) || value['status'] === undefined) return false;
    return true;
}

export function ApiUserFromJSON(json: any): ApiUser {
    return ApiUserFromJSONTyped(json, false);
}

export function ApiUserFromJSONTyped(json: any, ignoreDiscriminator: boolean): ApiUser {
    if (json == null) {
        return json;
    }
    return {
        
        'emailAddress': json['emailAddress'] == null ? undefined : json['emailAddress'],
        'externalRoles': json['externalRoles'] == null ? undefined : new Set(json['externalRoles']),
        'firstName': json['firstName'] == null ? undefined : json['firstName'],
        'lastName': json['lastName'] == null ? undefined : json['lastName'],
        'readOnly': json['readOnly'] == null ? undefined : json['readOnly'],
        'roles': json['roles'] == null ? undefined : new Set(json['roles']),
        'source': json['source'] == null ? undefined : json['source'],
        'status': json['status'],
        'userId': json['userId'] == null ? undefined : json['userId'],
    };
}

export function ApiUserToJSON(json: any): ApiUser {
    return ApiUserToJSONTyped(json, false);
}

export function ApiUserToJSONTyped(value?: ApiUser | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }

    return {
        
        'emailAddress': value['emailAddress'],
        'externalRoles': value['externalRoles'] == null ? undefined : Array.from(value['externalRoles'] as Set<any>),
        'firstName': value['firstName'],
        'lastName': value['lastName'],
        'readOnly': value['readOnly'],
        'roles': value['roles'] == null ? undefined : Array.from(value['roles'] as Set<any>),
        'source': value['source'],
        'status': value['status'],
        'userId': value['userId'],
    };
}

