/* tslint:disable */
/* eslint-disable */
/**
 * authentik
 * Making authentication simple.
 *
 * The version of the OpenAPI document: 2025.10.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 { mapValues } from '../runtime';
import type { EventActions } from './EventActions';
import {
    EventActionsFromJSON,
    EventActionsFromJSONTyped,
    EventActionsToJSON,
    EventActionsToJSONTyped,
} from './EventActions';

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



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

export function EventFromJSON(json: any): Event {
    return EventFromJSONTyped(json, false);
}

export function EventFromJSONTyped(json: any, ignoreDiscriminator: boolean): Event {
    if (json == null) {
        return json;
    }
    return {
        
        'pk': json['pk'],
        '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'],
        'created': (new Date(json['created'])),
        'expires': json['expires'] == null ? undefined : (new Date(json['expires'])),
        'brand': json['brand'] == null ? undefined : json['brand'],
    };
}

export function EventToJSON(json: any): Event {
    return EventToJSONTyped(json, false);
}

export function EventToJSONTyped(value?: Omit<Event, 'pk'|'created'> | 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 ? undefined : ((value['expires']).toISOString()),
        'brand': value['brand'],
    };
}

