/* tslint:disable */
/* eslint-disable */
/**
 * Scraper API
 * The scraping SaaS platform provides a RESTful API for developers to perform web scraping tasks. Users can submit scraping tasks, monitor task status, retrieve scraped data, and manage their account through the API.
 *
 * The version of the OpenAPI document: 1.0.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 { Actions } from './Actions';
import {
    ActionsFromJSON,
    ActionsFromJSONTyped,
    ActionsToJSON,
} from './Actions';
import type { DataToScrape } from './DataToScrape';
import {
    DataToScrapeFromJSON,
    DataToScrapeFromJSONTyped,
    DataToScrapeToJSON,
} from './DataToScrape';
import type { Frecuency } from './Frecuency';
import {
    FrecuencyFromJSON,
    FrecuencyFromJSONTyped,
    FrecuencyToJSON,
} from './Frecuency';

/**
 * 
 * @export
 * @interface Job
 */
export interface Job {
    /**
     * 
     * @type {string}
     * @memberof Job
     */
    id: string;
    /**
     * 
     * @type {string}
     * @memberof Job
     */
    website: string;
    /**
     * 
     * @type {Array<Actions>}
     * @memberof Job
     */
    actions?: Array<Actions>;
    /**
     * 
     * @type {Array<DataToScrape>}
     * @memberof Job
     */
    dataToScrape?: Array<DataToScrape>;
    /**
     * 
     * @type {Frecuency}
     * @memberof Job
     */
    frecuency: Frecuency;
    /**
     * 
     * @type {string}
     * @memberof Job
     */
    status?: JobStatusEnum;
    /**
     * 
     * @type {string}
     * @memberof Job
     */
    createdAt?: string;
    /**
     * 
     * @type {string}
     * @memberof Job
     */
    updatedAt?: string;
}


/**
 * @export
 */
export const JobStatusEnum = {
    Pending: 'Pending',
    InProgress: 'In Progress',
    Paused: 'Paused',
    Completed: 'Completed',
    Failed: 'Failed',
    Cancelled: 'Cancelled'
} as const;
export type JobStatusEnum = typeof JobStatusEnum[keyof typeof JobStatusEnum];


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

export function JobFromJSON(json: any): Job {
    return JobFromJSONTyped(json, false);
}

export function JobFromJSONTyped(json: any, ignoreDiscriminator: boolean): Job {
    if (json == null) {
        return json;
    }
    return {
        
        'id': json['id'],
        'website': json['website'],
        'actions': json['actions'] == null ? undefined : ((json['actions'] as Array<any>).map(ActionsFromJSON)),
        'dataToScrape': json['data_to_scrape'] == null ? undefined : ((json['data_to_scrape'] as Array<any>).map(DataToScrapeFromJSON)),
        'frecuency': FrecuencyFromJSON(json['frecuency']),
        'status': json['status'] == null ? undefined : json['status'],
        'createdAt': json['created_at'] == null ? undefined : json['created_at'],
        'updatedAt': json['updated_at'] == null ? undefined : json['updated_at'],
    };
}

export function JobToJSON(value?: Job | null): any {
    if (value == null) {
        return value;
    }
    return {
        
        'id': value['id'],
        'website': value['website'],
        'actions': value['actions'] == null ? undefined : ((value['actions'] as Array<any>).map(ActionsToJSON)),
        'data_to_scrape': value['dataToScrape'] == null ? undefined : ((value['dataToScrape'] as Array<any>).map(DataToScrapeToJSON)),
        'frecuency': FrecuencyToJSON(value['frecuency']),
        'status': value['status'],
        'created_at': value['createdAt'],
        'updated_at': value['updatedAt'],
    };
}

