/* 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 { Message } from './Message';
import {
    MessageFromJSON,
    MessageFromJSONTyped,
    MessageToJSON,
    MessageToJSONTyped,
} from './Message';
import type { TaskStatus } from './TaskStatus';
import {
    TaskStatusFromJSON,
    TaskStatusFromJSONTyped,
    TaskStatusToJSON,
    TaskStatusToJSONTyped,
} from './TaskStatus';
import type { Artifact } from './Artifact';
import {
    ArtifactFromJSON,
    ArtifactFromJSONTyped,
    ArtifactToJSON,
    ArtifactToJSONTyped,
} from './Artifact';

/**
 * Task structure as per A2A specification
 * @export
 * @interface Task
 */
export interface Task {
    /**
     * 
     * @type {Array<Artifact>}
     * @memberof Task
     */
    artifacts?: Array<Artifact> | null;
    /**
     * 
     * @type {Array<Message>}
     * @memberof Task
     */
    history?: Array<Message> | null;
    /**
     * 
     * @type {string}
     * @memberof Task
     */
    id: string;
    /**
     * 
     * @type {{ [key: string]: any; }}
     * @memberof Task
     */
    metadata?: { [key: string]: any; };
    /**
     * 
     * @type {string}
     * @memberof Task
     */
    sessionId: string;
    /**
     * 
     * @type {TaskStatus}
     * @memberof Task
     */
    status: TaskStatus;
}

/**
 * Check if a given object implements the Task interface.
 */
export function instanceOfTask(value: object): value is Task {
    if (!('id' in value) || value['id'] === undefined) return false;
    if (!('sessionId' in value) || value['sessionId'] === undefined) return false;
    if (!('status' in value) || value['status'] === undefined) return false;
    return true;
}

export function TaskFromJSON(json: any): Task {
    return TaskFromJSONTyped(json, false);
}

export function TaskFromJSONTyped(json: any, ignoreDiscriminator: boolean): Task {
    if (json == null) {
        return json;
    }
    return {
        
        'artifacts': json['artifacts'] == null ? undefined : ((json['artifacts'] as Array<any>).map(ArtifactFromJSON)),
        'history': json['history'] == null ? undefined : ((json['history'] as Array<any>).map(MessageFromJSON)),
        'id': json['id'],
        'metadata': json['metadata'] == null ? undefined : json['metadata'],
        'sessionId': json['sessionId'],
        'status': TaskStatusFromJSON(json['status']),
    };
}

export function TaskToJSON(json: any): Task {
    return TaskToJSONTyped(json, false);
}

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

    return {
        
        'artifacts': value['artifacts'] == null ? undefined : ((value['artifacts'] as Array<any>).map(ArtifactToJSON)),
        'history': value['history'] == null ? undefined : ((value['history'] as Array<any>).map(MessageToJSON)),
        'id': value['id'],
        'metadata': value['metadata'],
        'sessionId': value['sessionId'],
        'status': TaskStatusToJSON(value['status']),
    };
}

