/* 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 { AnthropicTextBlock } from './AnthropicTextBlock';
import {
    instanceOfAnthropicTextBlock,
    AnthropicTextBlockFromJSON,
    AnthropicTextBlockFromJSONTyped,
    AnthropicTextBlockToJSON,
} from './AnthropicTextBlock';
import type { AnthropicThinkingBlock } from './AnthropicThinkingBlock';
import {
    instanceOfAnthropicThinkingBlock,
    AnthropicThinkingBlockFromJSON,
    AnthropicThinkingBlockFromJSONTyped,
    AnthropicThinkingBlockToJSON,
} from './AnthropicThinkingBlock';
import type { AnthropicToolUseBlock } from './AnthropicToolUseBlock';
import {
    instanceOfAnthropicToolUseBlock,
    AnthropicToolUseBlockFromJSON,
    AnthropicToolUseBlockFromJSONTyped,
    AnthropicToolUseBlockToJSON,
} from './AnthropicToolUseBlock';

/**
 * @type ContentBlock1
 * 
 * @export
 */
export type ContentBlock1 = AnthropicTextBlock | AnthropicThinkingBlock | AnthropicToolUseBlock;

export function ContentBlock1FromJSON(json: any): ContentBlock1 {
    return ContentBlock1FromJSONTyped(json, false);
}

export function ContentBlock1FromJSONTyped(json: any, ignoreDiscriminator: boolean): ContentBlock1 {
    if (json == null) {
        return json;
    }
    if (instanceOfAnthropicTextBlock(json)) {
        return AnthropicTextBlockFromJSONTyped(json, true);
    }
    if (instanceOfAnthropicThinkingBlock(json)) {
        return AnthropicThinkingBlockFromJSONTyped(json, true);
    }
    if (instanceOfAnthropicToolUseBlock(json)) {
        return AnthropicToolUseBlockFromJSONTyped(json, true);
    }

    return {} as any;
}

export function ContentBlock1ToJSON(json: any): any {
    return ContentBlock1ToJSONTyped(json, false);
}

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

    if (instanceOfAnthropicTextBlock(value)) {
        return AnthropicTextBlockToJSON(value as AnthropicTextBlock);
    }
    if (instanceOfAnthropicThinkingBlock(value)) {
        return AnthropicThinkingBlockToJSON(value as AnthropicThinkingBlock);
    }
    if (instanceOfAnthropicToolUseBlock(value)) {
        return AnthropicToolUseBlockToJSON(value as AnthropicToolUseBlock);
    }

    return {};
}

