/* 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.50
 * 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 type { DeepNewsReportRequest } from './DeepNewsReportRequest';
import {
    instanceOfDeepNewsReportRequest,
    DeepNewsReportRequestFromJSON,
    DeepNewsReportRequestFromJSONTyped,
    DeepNewsReportRequestToJSON,
} from './DeepNewsReportRequest';
import type { LegacyReportRequest } from './LegacyReportRequest';
import {
    instanceOfLegacyReportRequest,
    LegacyReportRequestFromJSON,
    LegacyReportRequestFromJSONTyped,
    LegacyReportRequestToJSON,
} from './LegacyReportRequest';

/**
 * @type CreateAlertRequestReport
 * 
 * @export
 */
export type CreateAlertRequestReport = { identifier: 'deepnews' } & DeepNewsReportRequest | { identifier: 'legacy' } & LegacyReportRequest;

export function CreateAlertRequestReportFromJSON(json: any): CreateAlertRequestReport {
    return CreateAlertRequestReportFromJSONTyped(json, false);
}

export function CreateAlertRequestReportFromJSONTyped(json: any, ignoreDiscriminator: boolean): CreateAlertRequestReport {
    if (json == null) {
        return json;
    }
    switch (json['identifier']) {
        case 'deepnews':
            return Object.assign({}, DeepNewsReportRequestFromJSONTyped(json, true), { identifier: 'deepnews' } as const);
        case 'legacy':
            return Object.assign({}, LegacyReportRequestFromJSONTyped(json, true), { identifier: 'legacy' } as const);
        default:
            throw new Error(`No variant of CreateAlertRequestReport exists with 'identifier=${json['identifier']}'`);
    }
}

export function CreateAlertRequestReportToJSON(json: any): any {
    return CreateAlertRequestReportToJSONTyped(json, false);
}

export function CreateAlertRequestReportToJSONTyped(value?: CreateAlertRequestReport | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }
    switch (value['identifier']) {
        case 'deepnews':
            return Object.assign({}, DeepNewsReportRequestToJSON(value), { identifier: 'deepnews' } as const);
        case 'legacy':
            return Object.assign({}, LegacyReportRequestToJSON(value), { identifier: 'legacy' } as const);
        default:
            throw new Error(`No variant of CreateAlertRequestReport exists with 'identifier=${value['identifier']}'`);
    }

}

