/* 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";

/**
 * Serializer for Duo authenticator devices
 * @export
 * @interface DuoDevice
 */
export interface DuoDevice {
    /**
     *
     * @type {number}
     * @memberof DuoDevice
     */
    readonly pk: number;
    /**
     * The human-readable name of this device.
     * @type {string}
     * @memberof DuoDevice
     */
    name: string;
    /**
     *
     * @type {PartialUser}
     * @memberof DuoDevice
     */
    readonly user: PartialUser;
}

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

export function DuoDeviceFromJSON(json: any): DuoDevice {
    return DuoDeviceFromJSONTyped(json, false);
}

export function DuoDeviceFromJSONTyped(json: any, ignoreDiscriminator: boolean): DuoDevice {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        user: PartialUserFromJSON(json["user"]),
    };
}

export function DuoDeviceToJSON(json: any): DuoDevice {
    return DuoDeviceToJSONTyped(json, false);
}

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

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