/* 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 { GrantType } from './GrantType';
import {
    GrantTypeFromJSON,
    GrantTypeFromJSONTyped,
    GrantTypeToJSON,
    GrantTypeToJSONTyped,
} from './GrantType';

/**
 * 
 * @export
 * @interface TokenRequest
 */
export interface TokenRequest {
    /**
     * 
     * @type {GrantType}
     * @memberof TokenRequest
     */
    grantType?: GrantType;
    /**
     * 
     * @type {string}
     * @memberof TokenRequest
     */
    code?: string | null;
    /**
     * 
     * @type {string}
     * @memberof TokenRequest
     */
    username?: string | null;
    /**
     * 
     * @type {string}
     * @memberof TokenRequest
     */
    password?: string | null;
    /**
     * 
     * @type {string}
     * @memberof TokenRequest
     */
    refreshToken?: string | null;
    /**
     * 
     * @type {string}
     * @memberof TokenRequest
     */
    redirectUri?: string | null;
    /**
     * 
     * @type {string}
     * @memberof TokenRequest
     */
    codeVerifier?: string | null;
}



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

export function TokenRequestFromJSON(json: any): TokenRequest {
    return TokenRequestFromJSONTyped(json, false);
}

export function TokenRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): TokenRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'grantType': json['grant_type'] == null ? undefined : GrantTypeFromJSON(json['grant_type']),
        'code': json['code'] == null ? undefined : json['code'],
        'username': json['username'] == null ? undefined : json['username'],
        'password': json['password'] == null ? undefined : json['password'],
        'refreshToken': json['refresh_token'] == null ? undefined : json['refresh_token'],
        'redirectUri': json['redirect_uri'] == null ? undefined : json['redirect_uri'],
        'codeVerifier': json['code_verifier'] == null ? undefined : json['code_verifier'],
    };
}

export function TokenRequestToJSON(json: any): TokenRequest {
    return TokenRequestToJSONTyped(json, false);
}

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

    return {
        
        'grant_type': GrantTypeToJSON(value['grantType']),
        'code': value['code'],
        'username': value['username'],
        'password': value['password'],
        'refresh_token': value['refreshToken'],
        'redirect_uri': value['redirectUri'],
        'code_verifier': value['codeVerifier'],
    };
}

