/* tslint:disable */
/* eslint-disable */
/**
 * AutoGlue API
 * API for managing K3s clusters across cloud providers
 *
 * The version of the OpenAPI document: dev
 *
 *
 * 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 { DtoJobStatus } from "./DtoJobStatus";
import {
  DtoJobStatusFromJSON,
  DtoJobStatusFromJSONTyped,
  DtoJobStatusToJSON,
  DtoJobStatusToJSONTyped,
} from "./DtoJobStatus";

/**
 *
 * @export
 * @interface DtoJob
 */
export interface DtoJob {
  /**
   *
   * @type {number}
   * @memberof DtoJob
   */
  attempts?: number;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  created_at?: string;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  id?: string;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  last_error?: string;
  /**
   *
   * @type {number}
   * @memberof DtoJob
   */
  max_attempts?: number;
  /**
   *
   * @type {any}
   * @memberof DtoJob
   */
  payload?: any | null;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  queue?: string;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  run_at?: string;
  /**
   *
   * @type {DtoJobStatus}
   * @memberof DtoJob
   */
  status?: DtoJobStatus;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  type?: string;
  /**
   *
   * @type {string}
   * @memberof DtoJob
   */
  updated_at?: string;
}

/**
 * Check if a given object implements the DtoJob interface.
 */
export function instanceOfDtoJob(value: object): value is DtoJob {
  return true;
}

export function DtoJobFromJSON(json: any): DtoJob {
  return DtoJobFromJSONTyped(json, false);
}

export function DtoJobFromJSONTyped(
  json: any,
  ignoreDiscriminator: boolean,
): DtoJob {
  if (json == null) {
    return json;
  }
  return {
    attempts: json["attempts"] == null ? undefined : json["attempts"],
    created_at: json["created_at"] == null ? undefined : json["created_at"],
    id: json["id"] == null ? undefined : json["id"],
    last_error: json["last_error"] == null ? undefined : json["last_error"],
    max_attempts:
      json["max_attempts"] == null ? undefined : json["max_attempts"],
    payload: json["payload"] == null ? undefined : json["payload"],
    queue: json["queue"] == null ? undefined : json["queue"],
    run_at: json["run_at"] == null ? undefined : json["run_at"],
    status:
      json["status"] == null ? undefined : DtoJobStatusFromJSON(json["status"]),
    type: json["type"] == null ? undefined : json["type"],
    updated_at: json["updated_at"] == null ? undefined : json["updated_at"],
  };
}

export function DtoJobToJSON(json: any): DtoJob {
  return DtoJobToJSONTyped(json, false);
}

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

  return {
    attempts: value["attempts"],
    created_at: value["created_at"],
    id: value["id"],
    last_error: value["last_error"],
    max_attempts: value["max_attempts"],
    payload: value["payload"],
    queue: value["queue"],
    run_at: value["run_at"],
    status: DtoJobStatusToJSON(value["status"]),
    type: value["type"],
    updated_at: value["updated_at"],
  };
}
