/* 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 { PartialUser } from "./PartialUser";
import { PartialUserFromJSON } from "./PartialUser";
import type { StaticDeviceToken } from "./StaticDeviceToken";
import { StaticDeviceTokenFromJSON } from "./StaticDeviceToken";

/**
 * Serializer for static authenticator devices
 * @export
 * @interface StaticDevice
 */
export interface StaticDevice {
    /**
     * The human-readable name of this device.
     * @type {string}
     * @memberof StaticDevice
     */
    name: string;
    /**
     *
     * @type {Array<StaticDeviceToken>}
     * @memberof StaticDevice
     */
    readonly tokenSet: Array<StaticDeviceToken>;
    /**
     *
     * @type {number}
     * @memberof StaticDevice
     */
    readonly pk: number;
    /**
     *
     * @type {PartialUser}
     * @memberof StaticDevice
     */
    readonly user: PartialUser;
}

/**
 * Check if a given object implements the StaticDevice interface.
 */
export function instanceOfStaticDevice(value: object): value is StaticDevice {
    if (!("name" in value) || value["name"] === undefined) return false;
    if (!("tokenSet" in value) || value["tokenSet"] === undefined) return false;
    if (!("pk" in value) || value["pk"] === undefined) return false;
    if (!("user" in value) || value["user"] === undefined) return false;
    return true;
}

export function StaticDeviceFromJSON(json: any): StaticDevice {
    return StaticDeviceFromJSONTyped(json, false);
}

export function StaticDeviceFromJSONTyped(json: any, ignoreDiscriminator: boolean): StaticDevice {
    if (json == null) {
        return json;
    }
    return {
        name: json["name"],
        tokenSet: (json["token_set"] as Array<any>).map(StaticDeviceTokenFromJSON),
        pk: json["pk"],
        user: PartialUserFromJSON(json["user"]),
    };
}

export function StaticDeviceToJSON(json: any): StaticDevice {
    return StaticDeviceToJSONTyped(json, false);
}

export function StaticDeviceToJSONTyped(
    value?: Omit<StaticDevice, "token_set" | "pk" | "user"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

    return {
        name: value["name"],
    };
}
