/* 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 { WebAuthnDeviceType } from "./WebAuthnDeviceType";
import { WebAuthnDeviceTypeFromJSON } from "./WebAuthnDeviceType";

/**
 * Serializer for WebAuthn authenticator devices
 * @export
 * @interface WebAuthnDevice
 */
export interface WebAuthnDevice {
    /**
     *
     * @type {number}
     * @memberof WebAuthnDevice
     */
    readonly pk: number;
    /**
     *
     * @type {string}
     * @memberof WebAuthnDevice
     */
    name: string;
    /**
     *
     * @type {Date}
     * @memberof WebAuthnDevice
     */
    readonly createdOn: Date;
    /**
     *
     * @type {WebAuthnDeviceType}
     * @memberof WebAuthnDevice
     */
    readonly deviceType: WebAuthnDeviceType | null;
    /**
     *
     * @type {string}
     * @memberof WebAuthnDevice
     */
    readonly aaguid: string;
    /**
     *
     * @type {PartialUser}
     * @memberof WebAuthnDevice
     */
    readonly user: PartialUser;
}

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

export function WebAuthnDeviceFromJSON(json: any): WebAuthnDevice {
    return WebAuthnDeviceFromJSONTyped(json, false);
}

export function WebAuthnDeviceFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): WebAuthnDevice {
    if (json == null) {
        return json;
    }
    return {
        pk: json["pk"],
        name: json["name"],
        createdOn: new Date(json["created_on"]),
        deviceType: WebAuthnDeviceTypeFromJSON(json["device_type"]),
        aaguid: json["aaguid"],
        user: PartialUserFromJSON(json["user"]),
    };
}

export function WebAuthnDeviceToJSON(json: any): WebAuthnDevice {
    return WebAuthnDeviceToJSONTyped(json, false);
}

export function WebAuthnDeviceToJSONTyped(
    value?: Omit<WebAuthnDevice, "pk" | "created_on" | "device_type" | "aaguid" | "user"> | null,
    ignoreDiscriminator: boolean = false,
): any {
    if (value == null) {
        return value;
    }

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