export interface MetadataRefreshJob {
  trackId: string;
  refreshType: 'full' | 'partial';
}

export interface AudioAnalysisJob {
  trackId: string;
}

/** A bounded sweep is used for existing tracks, never an unbounded startup job. */
export interface AudioAnalysisSweepJob {
  reason?: 'scheduled' | 'manual';
  limit?: number;
}

export interface CleanupJob {
  reason: 'expired' | 'manual';
  targetFiles: string[];
}

export interface LibraryScanJob {
  directory: string;
}

// Periodic integrity sweep. No payload fields required; the worker reads
// MUSIC_DIR from env. Kept as an object for forward-compatibility.
export interface IntegritySweepJob {
  // Reserved for future scoping options (e.g. specific track ids).
  reason?: 'scheduled' | 'manual';
}

// Refresh Last.fm similar-artist data for a single artist (feeds Vibe discovery).
export interface ArtistSimilarityJob {
  artistId: string;
}

// Fetch/refresh a single artist's image via the fallback chain. Decoupled from
// track enrichment so image lookups don't run inline while processing tracks.
export interface ArtistImageJob {
  artistId: string;
}

// Fetch/refresh a single album's cover art (Discogs + Cover Art Archive).
// Decoupled from track enrichment for the same reason.
export interface AlbumCoverJob {
  albumId: string;
}

// Re-process all artists through the new identity pipeline.
// Useful after schema migrations or when identity logic changes.
export interface ReprocessArtistsJob {
  batchSize?: number;
  offset?: number;
}

/** System E acquisition job. Candidate details stay in Postgres, not Redis. */
export interface AcquisitionJob {
  candidateId: string;
}

/**
 * External candidate generation. Two job names share this payload because the
 * knobs are the same shape; the strategies themselves stay separate.
 */
export interface DiscoverySourceJob {
  reason?: string;
  /** new_release: artists to check. similar_recommendation: seed tracks. */
  seeds?: number;
  /** Candidates to keep per album (new_release) or per seed track (similar). */
  perSeed?: number;
}

export type JobPayload =
  | MetadataRefreshJob
  | ArtistSimilarityJob
  | ArtistImageJob
  | AlbumCoverJob
  | AudioAnalysisJob
  | AudioAnalysisSweepJob
  | CleanupJob
  | LibraryScanJob
  | IntegritySweepJob
  | ReprocessArtistsJob
  | AcquisitionJob
  | DiscoverySourceJob;
