/* tslint:disable */
/* eslint-disable */
/**
 * HumanLayer Daemon REST API
 * REST API for HumanLayer daemon operations, providing session management, approval workflows, and real-time event streaming capabilities. 
 *
 * The version of the OpenAPI document: 1.0.0
 * 
 *
 * 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 { EventType } from './EventType';
import {
    EventTypeFromJSON,
    EventTypeFromJSONTyped,
    EventTypeToJSON,
    EventTypeToJSONTyped,
} from './EventType';

/**
 * 
 * @export
 * @interface Event
 */
export interface Event {
    /**
     * 
     * @type {EventType}
     * @memberof Event
     */
    type: EventType;
    /**
     * Event timestamp
     * @type {Date}
     * @memberof Event
     */
    timestamp: Date;
    /**
     * Event-specific data
     * @type {{ [key: string]: any; }}
     * @memberof Event
     */
    data: { [key: string]: any; };
}



/**
 * Check if a given object implements the Event interface.
 */
export function instanceOfEvent(value: object): value is Event {
    if (!('type' in value) || value['type'] === undefined) return false;
    if (!('timestamp' in value) || value['timestamp'] === undefined) return false;
    if (!('data' in value) || value['data'] === 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 {
        
        'type': EventTypeFromJSON(json['type']),
        'timestamp': (new Date(json['timestamp'])),
        'data': json['data'],
    };
}

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

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

    return {
        
        'type': EventTypeToJSON(value['type']),
        'timestamp': ((value['timestamp']).toISOString()),
        'data': value['data'],
    };
}

