/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2026.5.3
 * 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 { DeviceClassesEnum } from "./DeviceClassesEnum";
import { DeviceClassesEnumFromJSON, DeviceClassesEnumToJSON } from "./DeviceClassesEnum";

/**
 * Single device challenge
 * @export
 * @interface DeviceChallengeRequest
 */
export interface DeviceChallengeRequest {
    /**
     *
     * @type {DeviceClassesEnum}
     * @memberof DeviceChallengeRequest
     */
    deviceClass: DeviceClassesEnum;
    /**
     *
     * @type {string}
     * @memberof DeviceChallengeRequest
     */
    deviceUid: string;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof DeviceChallengeRequest
     */
    challenge: { [key: string]: any };
    /**
     *
     * @type {Date}
     * @memberof DeviceChallengeRequest
     */
    lastUsed: Date | null;
}

/**
 * Check if a given object implements the DeviceChallengeRequest interface.
 */
export function instanceOfDeviceChallengeRequest(value: object): value is DeviceChallengeRequest {
    if (!("deviceClass" in value) || value["deviceClass"] === undefined) return false;
    if (!("deviceUid" in value) || value["deviceUid"] === undefined) return false;
    if (!("challenge" in value) || value["challenge"] === undefined) return false;
    if (!("lastUsed" in value) || value["lastUsed"] === undefined) return false;
    return true;
}

export function DeviceChallengeRequestFromJSON(json: any): DeviceChallengeRequest {
    return DeviceChallengeRequestFromJSONTyped(json, false);
}

export function DeviceChallengeRequestFromJSONTyped(
    json: any,
    ignoreDiscriminator: boolean,
): DeviceChallengeRequest {
    if (json == null) {
        return json;
    }
    return {
        deviceClass: DeviceClassesEnumFromJSON(json["device_class"]),
        deviceUid: json["device_uid"],
        challenge: json["challenge"],
        lastUsed: json["last_used"] == null ? null : new Date(json["last_used"]),
    };
}

export function DeviceChallengeRequestToJSON(json: any): DeviceChallengeRequest {
    return DeviceChallengeRequestToJSONTyped(json, false);
}

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

    return {
        device_class: DeviceClassesEnumToJSON(value["deviceClass"]),
        device_uid: value["deviceUid"],
        challenge: value["challenge"],
        last_used: value["lastUsed"] == null ? value["lastUsed"] : value["lastUsed"].toISOString(),
    };
}
