/* 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 { mapValues } from '../runtime';
import type { FileData } from './FileData';
import {
    FileDataFromJSON,
    FileDataFromJSONTyped,
    FileDataToJSON,
    FileDataToJSONTyped,
} from './FileData';

/**
 * Part structure as per A2A specification
 * @export
 * @interface Part
 */
export interface Part {
    /**
     * 
     * @type {string}
     * @memberof Part
     */
    text: string;
    /**
     * 
     * @type {string}
     * @memberof Part
     */
    type: PartTypeEnum;
    /**
     * 
     * @type {FileData}
     * @memberof Part
     */
    file: FileData;
    /**
     * 
     * @type {{ [key: string]: any; }}
     * @memberof Part
     */
    data: { [key: string]: any; };
    /**
     * 
     * @type {{ [key: string]: any; }}
     * @memberof Part
     */
    metadata?: { [key: string]: any; };
}


/**
 * @export
 */
export const PartTypeEnum = {
    Data: 'data'
} as const;
export type PartTypeEnum = typeof PartTypeEnum[keyof typeof PartTypeEnum];


/**
 * Check if a given object implements the Part interface.
 */
export function instanceOfPart(value: object): value is Part {
    if (!('text' in value) || value['text'] === undefined) return false;
    if (!('type' in value) || value['type'] === undefined) return false;
    if (!('file' in value) || value['file'] === undefined) return false;
    if (!('data' in value) || value['data'] === undefined) return false;
    return true;
}

export function PartFromJSON(json: any): Part {
    return PartFromJSONTyped(json, false);
}

export function PartFromJSONTyped(json: any, ignoreDiscriminator: boolean): Part {
    if (json == null) {
        return json;
    }
    return {
        
        'text': json['text'],
        'type': json['type'],
        'file': FileDataFromJSON(json['file']),
        'data': json['data'],
        'metadata': json['metadata'] == null ? undefined : json['metadata'],
    };
}

export function PartToJSON(json: any): Part {
    return PartToJSONTyped(json, false);
}

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

    return {
        
        'text': value['text'],
        'type': value['type'],
        'file': FileDataToJSON(value['file']),
        'data': value['data'],
        'metadata': value['metadata'],
    };
}

