/* tslint:disable */
/* eslint-disable */
/**
 * Tribufu API
 * API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.3.0
 * Contact: contact@tribufu.com
 *
 * 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';
import type { UserType } from './UserType';
import {
    UserTypeFromJSON,
    UserTypeFromJSONTyped,
    UserTypeToJSON,
    UserTypeToJSONTyped,
} from './UserType';

/**
 * 
 * @export
 * @interface UserInfo
 */
export interface UserInfo {
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    id?: string;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    uuid?: string;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    name: string | null;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    displayName?: string | null;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    email?: string | null;
    /**
     * 
     * @type {boolean}
     * @memberof UserInfo
     */
    emailVerified?: boolean;
    /**
     * 
     * @type {UserType}
     * @memberof UserInfo
     */
    type?: UserType;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    language?: string | null;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    timezone?: string | null;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    currency?: string | null;
    /**
     * 
     * @type {string}
     * @memberof UserInfo
     */
    photoUrl?: string | null;
    /**
     * 
     * @type {Array<string>}
     * @memberof UserInfo
     */
    permissions?: Array<string> | null;
    /**
     * 
     * @type {Date}
     * @memberof UserInfo
     */
    created?: Date;
    /**
     * 
     * @type {Date}
     * @memberof UserInfo
     */
    updated?: Date | null;
}



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

export function UserInfoFromJSON(json: any): UserInfo {
    return UserInfoFromJSONTyped(json, false);
}

export function UserInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): UserInfo {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'] == null ? undefined : json['id'],
        'uuid': json['uuid'] == null ? undefined : json['uuid'],
        'name': json['name'],
        'displayName': json['display_name'] == null ? undefined : json['display_name'],
        'email': json['email'] == null ? undefined : json['email'],
        'emailVerified': json['email_verified'] == null ? undefined : json['email_verified'],
        'type': json['type'] == null ? undefined : UserTypeFromJSON(json['type']),
        'language': json['language'] == null ? undefined : json['language'],
        'timezone': json['timezone'] == null ? undefined : json['timezone'],
        'currency': json['currency'] == null ? undefined : json['currency'],
        'photoUrl': json['photo_url'] == null ? undefined : json['photo_url'],
        'permissions': json['permissions'] == null ? undefined : json['permissions'],
        'created': json['created'] == null ? undefined : (new Date(json['created'])),
        'updated': json['updated'] == null ? undefined : (new Date(json['updated'])),
    };
}

export function UserInfoToJSON(json: any): UserInfo {
    return UserInfoToJSONTyped(json, false);
}

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

    return {
        
        'id': value['id'],
        'uuid': value['uuid'],
        'name': value['name'],
        'display_name': value['displayName'],
        'email': value['email'],
        'email_verified': value['emailVerified'],
        'type': UserTypeToJSON(value['type']),
        'language': value['language'],
        'timezone': value['timezone'],
        'currency': value['currency'],
        'photo_url': value['photoUrl'],
        'permissions': value['permissions'],
        'created': value['created'] == null ? undefined : ((value['created']).toISOString()),
        'updated': value['updated'] == null ? undefined : ((value['updated'] as any).toISOString()),
    };
}

