// Cynhyrchwyd y ffeil hon yn awtomatig. PEIDIWCH Â MODIWL
// This file is automatically generated. DO NOT EDIT

/**
 * Service is the frontend-facing surface of the download subsystem.
 * Its methods are bound into Wails and called from TypeScript, so
 * signatures use plain types and return errors the UI can render.
 * @module
 */

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import { Call as $Call, CancellablePromise as $CancellablePromise } from "@wailsio/runtime";

// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore: Unused imports
import * as $models from "./models.js";

/**
 * AddProvider creates a provider and stores any secret settings
 * separately.  Secrets arrive in the same map as ordinary settings
 * because that is what the form submits; they are split out here and
 * never written to the provider row.
 */
export function AddProvider(kind: string, name: string, settings: { [_ in string]?: string } | null): $CancellablePromise<number> {
    return $Call.ByID(2479360532, kind, name, settings);
}

/**
 * AddRequest puts something on the request list and asks for a
 * reconcile pass, so the user sees something happen rather than
 * waiting six hours for the next scheduled one.
 */
export function AddRequest(req: $models.RequestInput): $CancellablePromise<number> {
    return $Call.ByID(2621441882, req);
}

/**
 * Cancel aborts a live download.
 */
export function Cancel(downloadID: string): $CancellablePromise<void> {
    return $Call.ByID(1726338100, downloadID);
}

/**
 * Candidates returns the ranked candidates of a live download, so the
 * picker can be reopened without searching again.
 */
export function Candidates(downloadID: string): $CancellablePromise<$models.Candidate[] | null> {
    return $Call.ByID(2436454548, downloadID);
}

/**
 * ClearFinished removes terminal downloads from the list.
 */
export function ClearFinished(): $CancellablePromise<void> {
    return $Call.ByID(3757713449);
}

/**
 * ClearSatisfiedRequests drops everything already owned.
 */
export function ClearSatisfiedRequests(): $CancellablePromise<void> {
    return $Call.ByID(2681765363);
}

/**
 * DeleteProvider removes a provider and its credentials.
 */
export function DeleteProvider(id: number): $CancellablePromise<void> {
    return $Call.ByID(495153424, id);
}

/**
 * ImportExternalRequests adopts a provider's own list — "import the
 * artists Lidarr is already monitoring".
 */
export function ImportExternalRequests(providerID: number, libraryID: number): $CancellablePromise<number> {
    return $Call.ByID(4055326022, providerID, libraryID);
}

/**
 * IsRequested answers the Explore pages' question — should this album
 * show "want" or "wanted?" — without making them load the whole list.
 */
export function IsRequested(mbid: string, libraryID: number): $CancellablePromise<boolean> {
    return $Call.ByID(3695628158, mbid, libraryID);
}

/**
 * ListDownloads returns recent downloads, newest first.
 */
export function ListDownloads(limit: number): $CancellablePromise<$models.DownloadView[] | null> {
    return $Call.ByID(2505337995, limit);
}

/**
 * ListProviders returns the user's configured download clients.
 */
export function ListProviders(): $CancellablePromise<$models.Config[] | null> {
    return $Call.ByID(913508028);
}

/**
 * ListRequests returns the whole durable request list.
 */
export function ListRequests(): $CancellablePromise<$models.Request[] | null> {
    return $Call.ByID(3593452892);
}

/**
 * PauseRequest stops attempts without forgetting the request.
 */
export function PauseRequest(id: number, paused: boolean): $CancellablePromise<void> {
    return $Call.ByID(2652842089, id, paused);
}

/**
 * Pick starts the transfer for the candidate the user chose.
 */
export function Pick(downloadID: string, candidateID: string): $CancellablePromise<void> {
    return $Call.ByID(40308223, downloadID, candidateID);
}

/**
 * ProviderKinds returns every provider type that can be added, with the
 * settings each one needs.  The settings page renders its forms from
 * this, so a new adapter needs no frontend change.
 */
export function ProviderKinds(): $CancellablePromise<$models.Descriptor[] | null> {
    return $Call.ByID(2902376358);
}

/**
 * ReconcileRequests runs a pass now and reports what it did.  This
 * backs the "check now" button, so it runs synchronously: the user
 * pressed it and is waiting for an answer.
 */
export function ReconcileRequests(): $CancellablePromise<$models.Summary> {
    return $Call.ByID(593439868);
}

/**
 * RemoveRequest takes something off the list.  Removing an artist takes
 * its derived albums with it, by cascade; an album the user pinned
 * themselves has no parent and survives.
 */
export function RemoveRequest(id: number): $CancellablePromise<void> {
    return $Call.ByID(2423963479, id);
}

/**
 * SetPreferences pushes the auto-download guardrails straight into the
 * running Manager, without persisting them.  Persistence is
 * config.Config's job (GetDownloadPreferences/SetDownloadPreferences);
 * this package cannot depend on config, since config already depends on
 * download for UserConfig.  The frontend settings save is expected to
 * call the config setter and this method in the same action, the way
 * UpdateProvider already achieves "live without a restart" by touching
 * storage and the running Manager together.
 */
export function SetPreferences(prefs: $models.AutoDownloadPrefs): $CancellablePromise<void> {
    return $Call.ByID(3789717356, prefs);
}

/**
 * StartDownload searches for a release and either auto-picks a clear
 * winner or returns ranked candidates for the user to choose from.
 * 
 * When the search carries a MusicBrainz anchor, it also resolves or
 * creates the durable Request the anchor names and attaches it, via
 * ensureRequest — so a manual download that fails or finds nothing
 * right now leaves a durable record behind instead of just vanishing,
 * and the reconciler picks it up on its normal schedule exactly as if
 * the user had explicitly added it to the request list.
 */
export function StartDownload(req: $models.SearchRequest): $CancellablePromise<$models.StartResult> {
    return $Call.ByID(1191306198, req);
}

/**
 * TestProvider backs the "test connection" button.  It builds the
 * provider from its stored config and asks it to check itself, so the
 * result reflects exactly what a real search would use.
 */
export function TestProvider(id: number): $CancellablePromise<void> {
    return $Call.ByID(2688601475, id);
}

/**
 * UpdateProvider saves changes to a provider.  A secret field left
 * blank keeps its stored value rather than clearing it — the form does
 * not echo secrets back, so an empty box means "unchanged", not
 * "delete".
 */
export function UpdateProvider(id: number, name: string, enabled: boolean, priority: number, settings: { [_ in string]?: string } | null): $CancellablePromise<void> {
    return $Call.ByID(42359606, id, name, enabled, priority, settings);
}
