/* tslint:disable */
/* eslint-disable */
/**
 * Nech.PL Audio Intelligence API
 * Stem-aware audio analysis — emotion, features, sample role, loop grading, onsets/tempo, waveform & spectrogram, loudness, naming. The `audio` API of the Nech.PL APIs platform, served at /audio/v1/...; the gateway does central auth + metering (Bearer token).
 *
 * 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';
/**
 * The status of an async job (separate/sources/loops). `result` is populated
 * once `status == "done"`; `error` once `status == "error"`.
 * @export
 * @interface JobStatus
 */
export interface JobStatus {
    /**
     * 
     * @type {string}
     * @memberof JobStatus
     */
    jobId: string;
    /**
     * 
     * @type {string}
     * @memberof JobStatus
     */
    type: string;
    /**
     * 
     * @type {string}
     * @memberof JobStatus
     */
    status: string;
    /**
     * 
     * @type {number}
     * @memberof JobStatus
     */
    progress: number;
    /**
     * 
     * @type {{ [key: string]: any; }}
     * @memberof JobStatus
     */
    result?: { [key: string]: any; } | null;
    /**
     * 
     * @type {string}
     * @memberof JobStatus
     */
    resultRef?: string | null;
    /**
     * 
     * @type {string}
     * @memberof JobStatus
     */
    error?: string | null;
    /**
     * 
     * @type {number}
     * @memberof JobStatus
     */
    created: number;
    /**
     * 
     * @type {number}
     * @memberof JobStatus
     */
    started?: number | null;
    /**
     * 
     * @type {number}
     * @memberof JobStatus
     */
    finished?: number | null;
}

/**
 * Check if a given object implements the JobStatus interface.
 */
export function instanceOfJobStatus(value: object): value is JobStatus {
    if ((!('jobId' in value) && !('job_id' in value)) || (value['jobId'] === undefined && value['job_id'] === undefined)) return false;
    if (!('type' in value) || value['type'] === undefined) return false;
    if (!('status' in value) || value['status'] === undefined) return false;
    if (!('progress' in value) || value['progress'] === undefined) return false;
    if (!('created' in value) || value['created'] === undefined) return false;
    return true;
}

export function JobStatusFromJSON(json: any): JobStatus {
    return JobStatusFromJSONTyped(json, false);
}

export function JobStatusFromJSONTyped(json: any, ignoreDiscriminator: boolean): JobStatus {
    if (json == null) {
        return json;
    }
    return {
        
        'jobId': json['job_id'],
        'type': json['type'],
        'status': json['status'],
        'progress': json['progress'],
        'result': json['result'] == null ? undefined : json['result'],
        'resultRef': json['result_ref'] == null ? undefined : json['result_ref'],
        'error': json['error'] == null ? undefined : json['error'],
        'created': json['created'],
        'started': json['started'] == null ? undefined : json['started'],
        'finished': json['finished'] == null ? undefined : json['finished'],
    };
}

export function JobStatusToJSON(json: any): JobStatus {
    return JobStatusToJSONTyped(json, false);
}

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

    return {
        
        'job_id': value['jobId'],
        'type': value['type'],
        'status': value['status'],
        'progress': value['progress'],
        'result': value['result'],
        'result_ref': value['resultRef'],
        'error': value['error'],
        'created': value['created'],
        'started': value['started'],
        'finished': value['finished'],
    };
}

