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

/**
 * AlbumMatchView is "the autotagger already has a confident match for
 * the album you are looking at".
 * 
 * It is deliberately not a score. The album page renders a suggestion,
 * and a suggestion has to be actionable: which release, what it is
 * called, and whether acting on it here would do the whole album or
 * only part of it.
 */
export interface AlbumMatchView {
    /**
     * GroupKey is the tagging group the actions operate on.
     */
    "groupKey": string;

    /**
     * Recommendation is the tier, as a string, for a caller that
     * wants to render the strength rather than trust the filter.
     */
    "recommendation": string;

    /**
     * Score is the top candidate's raw score, 0..1.
     */
    "score": number;

    /**
     * ReleaseMBID is the release Apply would write.
     */
    "releaseMbid": string;

    /**
     * Title and ArtistCredit name that release, so the banner can say
     * what it is offering rather than "a match".
     */
    "title": string;
    "artistCredit": string;

    /**
     * TrackCount is the group's local track count.
     */
    "trackCount": number;

    /**
     * GroupCount is how many tagging groups this album spans.
     * 
     * More than one means a multi-disc album (one group per disc), and
     * it is the reason this is a field rather than an implementation
     * detail: applying "the album" from a single button would retag
     * one disc of three and leave the folder holding a mix of old and
     * new tags. The caller offers review instead.
     */
    "groupCount": number;
}

/**
 * AlignmentView mirrors autotag.TrackAlignment.  LocalIndex of -1
 * means "candidate has this track, folder doesn't" (status=missing).
 */
export interface AlignmentView {
    "localIndex": number;
    "localTitle": string;
    "localLengthMillis": number;
    "candidatePosition": number;
    "candidateDiscNumber": number;
    "candidateTitle": string;
    "candidateMbid": string;
    "candidateLength": number;
    "titleScore": number;
    "lengthDeltaMs": number;
    "trackNumberOk": boolean;
    "status": string;
}

/**
 * ApplyResultView mirrors autotag.ApplyResult for the frontend.
 */
export interface ApplyResultView {
    "groupKey": string;
    "succeeded": number;
    "failed": number;
    "failures": FailureView[] | null;
}

/**
 * CandidateView mirrors autotag.Candidate + its alignments.  The
 * CoverArtURL is populated eagerly only for the top-ranked
 * candidate (eager network fetch); the frontend calls
 * GetCandidateCoverArt to lazy-load art for the others when the
 * user selects them.  Date is this release's own date (re-issue
 * year for remasters); OriginalDate is the release-group's
 * first-release-date (the original album year).
 */
export interface CandidateView {
    "releaseMbid": string;
    "releaseGroupMbid": string;
    "title": string;
    "artistCredit": string;
    "date": string;
    "originalDate": string;
    "country": string;
    "status": string;
    "primaryType": string;
    "trackCount": number;
    "score": number;
    "breakdown": ScoreBreakdownView;
    "source": string;
    "provenance": string;
    "coverArtUrl": string;
    "alignments": AlignmentView[] | null;
}

/**
 * FailureView carries one failed track for the frontend's toast.
 */
export interface FailureView {
    "filePath": string;
    "error": string;
}

/**
 * LocalTrackView mirrors autotag.LocalTrack.
 */
export interface LocalTrackView {
    "audioFileId": number;
    "filePath": string;
    "title": string;
    "artist": string;
    "trackNumber": number;
    "discNumber": number;
    "lengthMillis": number;
    "recordingMbid": string;
}

/**
 * PendingItem is a projection of tagging_items that's safe to hand
 * to the frontend.  Score is dereferenced to 0 when NULL so TS sees
 * a plain number.
 */
export interface PendingItem {
    "groupKey": string;
    "libraryId": number;
    "libraryName": string;

    /**
     * FolderSubPath is the album folder's path relative to its
     * library root (e.g. "Beatles/Abbey Road").  Empty when the
     * path can't be derived (no audio files yet, missing library
     * row, etc.).  Populated by ListPendingFolders and
     * GetPendingFolder; not present on rows returned by other
     * list/get queries that haven't been extended.
     */
    "folderSubPath": string;
    "trackCount": number;
    "albumName": string;
    "albumArtist": string;
    "discNumber": number;
    "bestMatchReleaseMbid": string;
    "score": number;
    "status": string;

    /**
     * Synthetic marks a group SplitMixedFolder carved out of a
     * bigger folder by matching tags rather than a directory — the
     * review UI labels these distinctly since several may share the
     * same FolderSubPath.
     */
    "synthetic": boolean;

    /**
     * LikelyMixedBag is a cheap SQL-side approximation of autotag.
     * IsMixedBag, computed for the whole library in one pass by
     * ListPendingFolders (see ListLikelyMixedBagGroupKeys) rather
     * than hydrating every group's tracks in Go.  It's a badge hint,
     * not a guarantee — ScoreView.MixedBag (computed from the real
     * track list when a folder is opened) is the authoritative check
     * that gates the SplitMixedFolder action itself.
     */
    "likelyMixedBag": boolean;
}

/**
 * ScoreBreakdownView mirrors autotag.ScoreBreakdown for display.
 * Each field is in [0, 1].
 */
export interface ScoreBreakdownView {
    "titleAvg": number;
    "lengthAvg": number;
    "artistFit": number;
    "albumFit": number;
    "trackCountFit": number;
    "releaseMeta": number;
    "evidence": number;
}

/**
 * ScoreView is the Wails-friendly projection of autotag.GroupScore.
 */
export interface ScoreView {
    "groupKey": string;
    "localTracks": LocalTrackView[] | null;
    "candidates": CandidateView[] | null;

    /**
     * Recommendation is the qualitative confidence tier for the
     * ranked list: "none", "low", "medium", or "strong".  Unlike the
     * raw score it accounts for ambiguity (a rival release group
     * scoring nearly as high) and alignment defects.
     */
    "recommendation": string;

    /**
     * MixedBag is true when this group's tracks look like an
     * unrelated pile rather than one release (autotag.IsMixedBag) —
     * the review UI offers SplitMixedFolder when set.  Always false
     * for a group that's already Synthetic; a split group doesn't
     * get split again.
     */
    "mixedBag": boolean;

    /**
     * Synthetic mirrors PendingItem.Synthetic for the currently
     * open group.
     */
    "synthetic": boolean;
}

/**
 * SearchHitView is one in-app MusicBrainz search result surfaced to
 * the review UI.  Kind is "releasegroup" or "recording" so the
 * frontend knows which resolve path SelectSearchCandidate must take.
 */
export interface SearchHitView {
    "mbid": string;
    "kind": string;
    "title": string;
    "artist": string;
    "detail": string;
}
