/* tslint:disable */
/* eslint-disable */
/**
 * AskNews API
 * AskNews API [![status](https://status.asknews.app/api/badge/2/status?style=for-the-badge)](https://status.asknews.app/status/prod)
 *
 * The version of the OpenAPI document: 0.24.66
 * Contact: contact@emergentmethods.ai
 *
 * 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 { Report } from './Report';
import {
    ReportFromJSON,
    ReportFromJSONTyped,
    ReportToJSON,
    ReportToJSONTyped,
} from './Report';

/**
 * 
 * @export
 * @interface AlertResponse
 */
export interface AlertResponse {
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    id: string;
    /**
     * 
     * @type {Date}
     * @memberof AlertResponse
     */
    createdAt?: Date | null;
    /**
     * 
     * @type {Date}
     * @memberof AlertResponse
     */
    updatedAt?: Date | null;
    /**
     * 
     * @type {Date}
     * @memberof AlertResponse
     */
    expiresAt?: Date | null;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    userId: string;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    query?: string | null;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    cron: string;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    model: string | null;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    shareLink?: string | null;
    /**
     * 
     * @type {Array<{ [key: string]: any; } | null>}
     * @memberof AlertResponse
     */
    sources?: Array<{ [key: string]: any; } | null> | null;
    /**
     * 
     * @type {Report}
     * @memberof AlertResponse
     */
    report?: Report | null;
    /**
     * 
     * @type {Array<{ [key: string]: any; } | null>}
     * @memberof AlertResponse
     */
    triggers: Array<{ [key: string]: any; } | null>;
    /**
     * 
     * @type {boolean}
     * @memberof AlertResponse
     */
    alwaysTrigger?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof AlertResponse
     */
    repeat?: boolean;
    /**
     * 
     * @type {boolean}
     * @memberof AlertResponse
     */
    active?: boolean;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    alertType?: AlertResponseAlertTypeEnum | null;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    title?: string | null;
    /**
     * 
     * @type {string}
     * @memberof AlertResponse
     */
    seatId?: string | null;
}


/**
 * @export
 */
export const AlertResponseAlertTypeEnum = {
    AlwaysAlertWhen: 'AlwaysAlertWhen',
    AlertOnceIf: 'AlertOnceIf',
    ReportAbout: 'ReportAbout'
} as const;
export type AlertResponseAlertTypeEnum = typeof AlertResponseAlertTypeEnum[keyof typeof AlertResponseAlertTypeEnum];


/**
 * Check if a given object implements the AlertResponse interface.
 */
export function instanceOfAlertResponse(value: object): value is AlertResponse {
    if (!('id' in value) || value['id'] === undefined) return false;
    if (!('userId' in value) || value['userId'] === undefined) return false;
    if (!('cron' in value) || value['cron'] === undefined) return false;
    if (!('model' in value) || value['model'] === undefined) return false;
    if (!('triggers' in value) || value['triggers'] === undefined) return false;
    return true;
}

export function AlertResponseFromJSON(json: any): AlertResponse {
    return AlertResponseFromJSONTyped(json, false);
}

export function AlertResponseFromJSONTyped(json: any, ignoreDiscriminator: boolean): AlertResponse {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'],
        'createdAt': json['created_at'] == null ? undefined : (new Date(json['created_at'])),
        'updatedAt': json['updated_at'] == null ? undefined : (new Date(json['updated_at'])),
        'expiresAt': json['expires_at'] == null ? undefined : (new Date(json['expires_at'])),
        'userId': json['user_id'],
        'query': json['query'] == null ? undefined : json['query'],
        'cron': json['cron'],
        'model': json['model'],
        'shareLink': json['share_link'] == null ? undefined : json['share_link'],
        'sources': json['sources'] == null ? undefined : json['sources'],
        'report': json['report'] == null ? undefined : ReportFromJSON(json['report']),
        'triggers': json['triggers'],
        'alwaysTrigger': json['always_trigger'] == null ? undefined : json['always_trigger'],
        'repeat': json['repeat'] == null ? undefined : json['repeat'],
        'active': json['active'] == null ? undefined : json['active'],
        'alertType': json['alert_type'] == null ? undefined : json['alert_type'],
        'title': json['title'] == null ? undefined : json['title'],
        'seatId': json['seat_id'] == null ? undefined : json['seat_id'],
    };
}

export function AlertResponseToJSON(json: any): AlertResponse {
    return AlertResponseToJSONTyped(json, false);
}

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

    return {
        
        'id': value['id'],
        'created_at': value['createdAt'] == null ? undefined : ((value['createdAt'] as any).toISOString()),
        'updated_at': value['updatedAt'] == null ? undefined : ((value['updatedAt'] as any).toISOString()),
        'expires_at': value['expiresAt'] == null ? undefined : ((value['expiresAt'] as any).toISOString()),
        'user_id': value['userId'],
        'query': value['query'],
        'cron': value['cron'],
        'model': value['model'],
        'share_link': value['shareLink'],
        'sources': value['sources'],
        'report': ReportToJSON(value['report']),
        'triggers': value['triggers'],
        'always_trigger': value['alwaysTrigger'],
        'repeat': value['repeat'],
        'active': value['active'],
        'alert_type': value['alertType'],
        'title': value['title'],
        'seat_id': value['seatId'],
    };
}

