/* tslint:disable */
/* eslint-disable */
/**
 * Jellyfin API
 * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
 *
 * The version of the OpenAPI document: 10.8.9
 * 
 *
 * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
 * https://openapi-generator.tech
 * Do not edit the class manually.
 */

import { exists, mapValues } from '../runtime';
import type { TaskInfoLastExecutionResult } from './TaskInfoLastExecutionResult';
import {
    TaskInfoLastExecutionResultFromJSON,
    TaskInfoLastExecutionResultFromJSONTyped,
    TaskInfoLastExecutionResultToJSON,
} from './TaskInfoLastExecutionResult';
import type { TaskState } from './TaskState';
import {
    TaskStateFromJSON,
    TaskStateFromJSONTyped,
    TaskStateToJSON,
} from './TaskState';
import type { TaskTriggerInfo } from './TaskTriggerInfo';
import {
    TaskTriggerInfoFromJSON,
    TaskTriggerInfoFromJSONTyped,
    TaskTriggerInfoToJSON,
} from './TaskTriggerInfo';

/**
 * Class TaskInfo.
 * @export
 * @interface TaskInfo
 */
export interface TaskInfo {
    /**
     * Gets or sets the name.
     * @type {string}
     * @memberof TaskInfo
     */
    name?: string | null;
    /**
     * 
     * @type {TaskState}
     * @memberof TaskInfo
     */
    state?: TaskState;
    /**
     * Gets or sets the progress.
     * @type {number}
     * @memberof TaskInfo
     */
    currentProgressPercentage?: number | null;
    /**
     * Gets or sets the id.
     * @type {string}
     * @memberof TaskInfo
     */
    id?: string | null;
    /**
     * 
     * @type {TaskInfoLastExecutionResult}
     * @memberof TaskInfo
     */
    lastExecutionResult?: TaskInfoLastExecutionResult | null;
    /**
     * Gets or sets the triggers.
     * @type {Array<TaskTriggerInfo>}
     * @memberof TaskInfo
     */
    triggers?: Array<TaskTriggerInfo> | null;
    /**
     * Gets or sets the description.
     * @type {string}
     * @memberof TaskInfo
     */
    description?: string | null;
    /**
     * Gets or sets the category.
     * @type {string}
     * @memberof TaskInfo
     */
    category?: string | null;
    /**
     * Gets or sets a value indicating whether this instance is hidden.
     * @type {boolean}
     * @memberof TaskInfo
     */
    isHidden?: boolean;
    /**
     * Gets or sets the key.
     * @type {string}
     * @memberof TaskInfo
     */
    key?: string | null;
}

/**
 * Check if a given object implements the TaskInfo interface.
 */
export function instanceOfTaskInfo(value: object): boolean {
    let isInstance = true;

    return isInstance;
}

export function TaskInfoFromJSON(json: any): TaskInfo {
    return TaskInfoFromJSONTyped(json, false);
}

export function TaskInfoFromJSONTyped(json: any, ignoreDiscriminator: boolean): TaskInfo {
    if ((json === undefined) || (json === null)) {
        return json;
    }
    return {
        
        'name': !exists(json, 'Name') ? undefined : json['Name'],
        'state': !exists(json, 'State') ? undefined : TaskStateFromJSON(json['State']),
        'currentProgressPercentage': !exists(json, 'CurrentProgressPercentage') ? undefined : json['CurrentProgressPercentage'],
        'id': !exists(json, 'Id') ? undefined : json['Id'],
        'lastExecutionResult': !exists(json, 'LastExecutionResult') ? undefined : TaskInfoLastExecutionResultFromJSON(json['LastExecutionResult']),
        'triggers': !exists(json, 'Triggers') ? undefined : (json['Triggers'] === null ? null : (json['Triggers'] as Array<any>).map(TaskTriggerInfoFromJSON)),
        'description': !exists(json, 'Description') ? undefined : json['Description'],
        'category': !exists(json, 'Category') ? undefined : json['Category'],
        'isHidden': !exists(json, 'IsHidden') ? undefined : json['IsHidden'],
        'key': !exists(json, 'Key') ? undefined : json['Key'],
    };
}

export function TaskInfoToJSON(value?: TaskInfo | null): any {
    if (value === undefined) {
        return undefined;
    }
    if (value === null) {
        return null;
    }
    return {
        
        'Name': value.name,
        'State': TaskStateToJSON(value.state),
        'CurrentProgressPercentage': value.currentProgressPercentage,
        'Id': value.id,
        'LastExecutionResult': TaskInfoLastExecutionResultToJSON(value.lastExecutionResult),
        'Triggers': value.triggers === undefined ? undefined : (value.triggers === null ? null : (value.triggers as Array<any>).map(TaskTriggerInfoToJSON)),
        'Description': value.description,
        'Category': value.category,
        'IsHidden': value.isHidden,
        'Key': value.key,
    };
}

