/* 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 { Pagination } from "./Pagination";
import { PaginationFromJSON, PaginationToJSON } from "./Pagination";
import type { Token } from "./Token";
import { TokenFromJSON, TokenToJSON } from "./Token";

/**
 *
 * @export
 * @interface PaginatedTokenList
 */
export interface PaginatedTokenList {
    /**
     *
     * @type {Pagination}
     * @memberof PaginatedTokenList
     */
    pagination: Pagination;
    /**
     *
     * @type {Array<Token>}
     * @memberof PaginatedTokenList
     */
    results: Array<Token>;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof PaginatedTokenList
     */
    autocomplete: { [key: string]: any };
}

/**
 * Check if a given object implements the PaginatedTokenList interface.
 */
export function instanceOfPaginatedTokenList(value: object): value is PaginatedTokenList {
    if (!("pagination" in value) || value["pagination"] === undefined) return false;
    if (!("results" in value) || value["results"] === undefined) return false;
    if (!("autocomplete" in value) || value["autocomplete"] === undefined) return false;
    return true;
}

export function PaginatedTokenListFromJSON(json: any): PaginatedTokenList {
    return PaginatedTokenListFromJSONTyped(json, false);
}

export function PaginatedTokenListFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): PaginatedTokenList {
    if (json == null) {
        return json;
    }
    return {
        pagination: PaginationFromJSON(json["pagination"]),
        results: (json["results"] as Array<any>).map(TokenFromJSON),
        autocomplete: json["autocomplete"],
    };
}

export function PaginatedTokenListToJSON(json: any): PaginatedTokenList {
    return PaginatedTokenListToJSONTyped(json, false);
}

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

    return {
        pagination: PaginationToJSON(value["pagination"]),
        results: (value["results"] as Array<any>).map(TokenToJSON),
        autocomplete: value["autocomplete"],
    };
}
