/* 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 type { AnthropicTextBlock1 } from './AnthropicTextBlock1';
import {
    instanceOfAnthropicTextBlock1,
    AnthropicTextBlock1FromJSON,
    AnthropicTextBlock1FromJSONTyped,
    AnthropicTextBlock1ToJSON,
} from './AnthropicTextBlock1';
import type { AnthropicThinkingBlock1 } from './AnthropicThinkingBlock1';
import {
    instanceOfAnthropicThinkingBlock1,
    AnthropicThinkingBlock1FromJSON,
    AnthropicThinkingBlock1FromJSONTyped,
    AnthropicThinkingBlock1ToJSON,
} from './AnthropicThinkingBlock1';
import type { AnthropicToolUseBlock1 } from './AnthropicToolUseBlock1';
import {
    instanceOfAnthropicToolUseBlock1,
    AnthropicToolUseBlock1FromJSON,
    AnthropicToolUseBlock1FromJSONTyped,
    AnthropicToolUseBlock1ToJSON,
} from './AnthropicToolUseBlock1';

/**
 * @type ContentBlock
 * 
 * @export
 */
export type ContentBlock = AnthropicTextBlock1 | AnthropicThinkingBlock1 | AnthropicToolUseBlock1;

export function ContentBlockFromJSON(json: any): ContentBlock {
    return ContentBlockFromJSONTyped(json, false);
}

export function ContentBlockFromJSONTyped(json: any, ignoreDiscriminator: boolean): ContentBlock {
    if (json == null) {
        return json;
    }
    if (instanceOfAnthropicTextBlock1(json)) {
        return AnthropicTextBlock1FromJSONTyped(json, true);
    }
    if (instanceOfAnthropicThinkingBlock1(json)) {
        return AnthropicThinkingBlock1FromJSONTyped(json, true);
    }
    if (instanceOfAnthropicToolUseBlock1(json)) {
        return AnthropicToolUseBlock1FromJSONTyped(json, true);
    }

    return {} as any;
}

export function ContentBlockToJSON(json: any): any {
    return ContentBlockToJSONTyped(json, false);
}

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

    if (instanceOfAnthropicTextBlock1(value)) {
        return AnthropicTextBlock1ToJSON(value as AnthropicTextBlock1);
    }
    if (instanceOfAnthropicThinkingBlock1(value)) {
        return AnthropicThinkingBlock1ToJSON(value as AnthropicThinkingBlock1);
    }
    if (instanceOfAnthropicToolUseBlock1(value)) {
        return AnthropicToolUseBlock1ToJSON(value as AnthropicToolUseBlock1);
    }

    return {};
}

