/* tslint:disable */
/* eslint-disable */
/**
 * elkar-app
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 0.1.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 type { PartTypeOneOf } from './PartTypeOneOf';
import {
    instanceOfPartTypeOneOf,
    PartTypeOneOfFromJSON,
    PartTypeOneOfFromJSONTyped,
    PartTypeOneOfToJSON,
} from './PartTypeOneOf';
import type { PartTypeOneOf1 } from './PartTypeOneOf1';
import {
    instanceOfPartTypeOneOf1,
    PartTypeOneOf1FromJSON,
    PartTypeOneOf1FromJSONTyped,
    PartTypeOneOf1ToJSON,
} from './PartTypeOneOf1';
import type { PartTypeOneOf2 } from './PartTypeOneOf2';
import {
    instanceOfPartTypeOneOf2,
    PartTypeOneOf2FromJSON,
    PartTypeOneOf2FromJSONTyped,
    PartTypeOneOf2ToJSON,
} from './PartTypeOneOf2';

/**
 * @type PartType
 * Part types for message and artifact parts
 * @export
 */
export type PartType = PartTypeOneOf | PartTypeOneOf1 | PartTypeOneOf2;

export function PartTypeFromJSON(json: any): PartType {
    return PartTypeFromJSONTyped(json, false);
}

export function PartTypeFromJSONTyped(json: any, ignoreDiscriminator: boolean): PartType {
    if (json == null) {
        return json;
    }
    if (typeof json !== 'object') {
        return json;
    }
    if (instanceOfPartTypeOneOf(json)) {
        return PartTypeOneOfFromJSONTyped(json, true);
    }
    if (instanceOfPartTypeOneOf1(json)) {
        return PartTypeOneOf1FromJSONTyped(json, true);
    }
    if (instanceOfPartTypeOneOf2(json)) {
        return PartTypeOneOf2FromJSONTyped(json, true);
    }

    return {} as any;
}

export function PartTypeToJSON(json: any): any {
    return PartTypeToJSONTyped(json, false);
}

export function PartTypeToJSONTyped(value?: PartType | null, ignoreDiscriminator: boolean = false): any {
    if (value == null) {
        return value;
    }
    if (typeof value !== 'object') {
        return value;
    }
    if (instanceOfPartTypeOneOf(value)) {
        return PartTypeOneOfToJSON(value as PartTypeOneOf);
    }
    if (instanceOfPartTypeOneOf1(value)) {
        return PartTypeOneOf1ToJSON(value as PartTypeOneOf1);
    }
    if (instanceOfPartTypeOneOf2(value)) {
        return PartTypeOneOf2ToJSON(value as PartTypeOneOf2);
    }

    return {};
}

