/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.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 type { Endpoint } from "./Endpoint";
import { EndpointFromJSON } from "./Endpoint";
import type { PartialUser } from "./PartialUser";
import { PartialUserFromJSON } from "./PartialUser";
import type { RACProvider } from "./RACProvider";
import { RACProviderFromJSON } from "./RACProvider";

/**
 * ConnectionToken Serializer
 * @export
 * @interface ConnectionToken
 */
export interface ConnectionToken {
    /**
     *
     * @type {string}
     * @memberof ConnectionToken
     */
    pk?: string;
    /**
     *
     * @type {number}
     * @memberof ConnectionToken
     */
    provider: number;
    /**
     *
     * @type {RACProvider}
     * @memberof ConnectionToken
     */
    readonly providerObj: RACProvider;
    /**
     *
     * @type {string}
     * @memberof ConnectionToken
     */
    endpoint: string;
    /**
     *
     * @type {Endpoint}
     * @memberof ConnectionToken
     */
    readonly endpointObj: Endpoint;
    /**
     *
     * @type {PartialUser}
     * @memberof ConnectionToken
     */
    readonly user: PartialUser;
}

/**
 * Check if a given object implements the ConnectionToken interface.
 */
export function instanceOfConnectionToken(value: object): value is ConnectionToken {
    if (!("provider" in value) || value["provider"] === undefined) return false;
    if (!("providerObj" in value) || value["providerObj"] === undefined) return false;
    if (!("endpoint" in value) || value["endpoint"] === undefined) return false;
    if (!("endpointObj" in value) || value["endpointObj"] === undefined) return false;
    if (!("user" in value) || value["user"] === undefined) return false;
    return true;
}

export function ConnectionTokenFromJSON(json: any): ConnectionToken {
    return ConnectionTokenFromJSONTyped(json, false);
}

export function ConnectionTokenFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): ConnectionToken {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"] == null ? undefined : json["pk"],
        provider: json["provider"],
        providerObj: RACProviderFromJSON(json["provider_obj"]),
        endpoint: json["endpoint"],
        endpointObj: EndpointFromJSON(json["endpoint_obj"]),
        user: PartialUserFromJSON(json["user"]),
    };
}

export function ConnectionTokenToJSON(json: any): ConnectionToken {
    return ConnectionTokenToJSONTyped(json, false);
}

export function ConnectionTokenToJSONTyped(
    value?: Omit<ConnectionToken, "provider_obj" | "endpoint_obj" | "user"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        pk: value["pk"],
        provider: value["provider"],
        endpoint: value["endpoint"],
    };
}
