/* 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 { EventActions } from "./EventActions";
import { EventActionsFromJSON, EventActionsToJSON } from "./EventActions";

/**
 * Event Serializer
 * @export
 * @interface EventRequest
 */
export interface EventRequest {
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof EventRequest
     */
    user?: { [key: string]: any };
    /**
     *
     * @type {EventActions}
     * @memberof EventRequest
     */
    action: EventActions;
    /**
     *
     * @type {string}
     * @memberof EventRequest
     */
    app: string;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof EventRequest
     */
    context?: { [key: string]: any };
    /**
     *
     * @type {string}
     * @memberof EventRequest
     */
    clientIp?: string | null;
    /**
     *
     * @type {Date}
     * @memberof EventRequest
     */
    expires?: Date;
    /**
     *
     * @type {{ [key: string]: any; }}
     * @memberof EventRequest
     */
    brand?: { [key: string]: any };
}

/**
 * Check if a given object implements the EventRequest interface.
 */
export function instanceOfEventRequest(value: object): value is EventRequest {
    if (!("action" in value) || value["action"] === undefined) return false;
    if (!("app" in value) || value["app"] === undefined) return false;
    return true;
}

export function EventRequestFromJSON(json: any): EventRequest {
    return EventRequestFromJSONTyped(json, false);
}

export function EventRequestFromJSONTyped(json: any, ignoreDiscriminator: boolean): EventRequest {
    if (json == null) {
        return json;
    }
    return {
        user: json["user"] == null ? undefined : json["user"],
        action: EventActionsFromJSON(json["action"]),
        app: json["app"],
        context: json["context"] == null ? undefined : json["context"],
        clientIp: json["client_ip"] == null ? undefined : json["client_ip"],
        expires: json["expires"] == null ? undefined : new Date(json["expires"]),
        brand: json["brand"] == null ? undefined : json["brand"],
    };
}

export function EventRequestToJSON(json: any): EventRequest {
    return EventRequestToJSONTyped(json, false);
}

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

    return {
        user: value["user"],
        action: EventActionsToJSON(value["action"]),
        app: value["app"],
        context: value["context"],
        client_ip: value["clientIp"],
        expires: value["expires"] == null ? value["expires"] : value["expires"].toISOString(),
        brand: value["brand"],
    };
}
