/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.0-rc1
 * Contact: hello@goauthentik.io
 *
 * 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 { IntentEnum } from './IntentEnum';
import {
    IntentEnumFromJSON,
    IntentEnumFromJSONTyped,
    IntentEnumToJSON,
    IntentEnumToJSONTyped,
} from './IntentEnum';

/**
 * Token Serializer
 * @export
 * @interface PatchedTokenRequest
 */
export interface PatchedTokenRequest {
    /**
     * Objects that are managed by authentik. These objects are created and updated automatically. This flag only indicates that an object can be overwritten by migrations. You can still modify the objects via the API, but expect changes to be overwritten in a later update.
     * @type {string}
     * @memberof PatchedTokenRequest
     */
    managed?: string | null;
    /**
     * 
     * @type {string}
     * @memberof PatchedTokenRequest
     */
    identifier?: string;
    /**
     * 
     * @type {IntentEnum}
     * @memberof PatchedTokenRequest
     */
    intent?: IntentEnum;
    /**
     * 
     * @type {number}
     * @memberof PatchedTokenRequest
     */
    user?: number;
    /**
     * 
     * @type {string}
     * @memberof PatchedTokenRequest
     */
    description?: string;
    /**
     * 
     * @type {Date}
     * @memberof PatchedTokenRequest
     */
    expires?: Date | null;
    /**
     * 
     * @type {boolean}
     * @memberof PatchedTokenRequest
     */
    expiring?: boolean;
}



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

export function PatchedTokenRequestFromJSON(json: any): PatchedTokenRequest {
    return PatchedTokenRequestFromJSONTyped(json, false);
}

export function PatchedTokenRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): PatchedTokenRequest {
    if (json == null) {
        return json;
    }
    return {
        
        'managed': json['managed'] == null ? undefined : json['managed'],
        'identifier': json['identifier'] == null ? undefined : json['identifier'],
        'intent': json['intent'] == null ? undefined : IntentEnumFromJSON(json['intent']),
        'user': json['user'] == null ? undefined : json['user'],
        'description': json['description'] == null ? undefined : json['description'],
        'expires': json['expires'] == null ? undefined : (new Date(json['expires'])),
        'expiring': json['expiring'] == null ? undefined : json['expiring'],
    };
}

export function PatchedTokenRequestToJSON(json: any): PatchedTokenRequest {
    return PatchedTokenRequestToJSONTyped(json, false);
}

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

    return {
        
        'managed': value['managed'],
        'identifier': value['identifier'],
        'intent': IntentEnumToJSON(value['intent']),
        'user': value['user'],
        'description': value['description'],
        'expires': value['expires'] === null ? null : ((value['expires'] as any)?.toISOString()),
        'expiring': value['expiring'],
    };
}

