/* tslint:disable */
/* eslint-disable */
/**
 * Tribufu API
 * REST API to access Tribufu services.
 *
 * The version of the OpenAPI document: 1.1.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 { UserInfo } from './UserInfo';
import {
    UserInfoFromJSON,
    UserInfoFromJSONTyped,
    UserInfoToJSON,
    UserInfoToJSONTyped,
} from './UserInfo';

/**
 * 
 * @export
 * @interface LoginResponse
 */
export interface LoginResponse {
    /**
     * 
     * @type {UserInfo}
     * @memberof LoginResponse
     */
    user?: UserInfo;
    /**
     * 
     * @type {string}
     * @memberof LoginResponse
     */
    accessToken?: string | null;
    /**
     * 
     * @type {string}
     * @memberof LoginResponse
     */
    refreshToken?: string | null;
    /**
     * 
     * @type {number}
     * @memberof LoginResponse
     */
    expiresIn?: number;
}

/**
 * Check if a given object implements the LoginResponse interface.
 */
export function instanceOfLoginResponse(value: object): value is LoginResponse {
    return true;
}

export function LoginResponseFromJSON(json: any): LoginResponse {
    return LoginResponseFromJSONTyped(json, false);
}

export function LoginResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): LoginResponse {
    if (json == null) {
        return json;
    }
    return {
        
        'user': json['user'] == null ? undefined : UserInfoFromJSON(json['user']),
        'accessToken': json['access_token'] == null ? undefined : json['access_token'],
        'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
        'expiresIn': json['expires_in'] == null ? undefined : json['expires_in'],
    };
}

export function LoginResponseToJSON(json: any): LoginResponse {
    return LoginResponseToJSONTyped(json, false);
}

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

    return {
        
        'user': UserInfoToJSON(value['user']),
        'access_token': value['accessToken'],
        'refresh_token': value['refreshToken'],
        'expires_in': value['expiresIn'],
    };
}

