package lidarr

import (
	"errors"

	"git.fabledsword.com/bvandeusen/minstrel/internal/apierror"
)

// Sentinel errors. Callers branch on these via errors.Is, not on
// HTTP status codes — the client maps codes to errors.
var (
	ErrUnreachable    = errors.New("lidarr: unreachable")
	ErrAuthFailed     = errors.New("lidarr: auth failed")   // 401 / 403
	ErrLookupFailed   = errors.New("lidarr: lookup failed") // 4xx other than 401/403
	ErrServerError    = errors.New("lidarr: server error")  // 5xx
	ErrInvalidPayload = errors.New("lidarr: invalid payload")
	// ErrAlreadyExists is returned by AddArtist/AddAlbum when Lidarr
	// rejects the add with a 400 because the artist/album is already in
	// its library. This is the desired end state, not a failure — the
	// idempotent retry path (reconciler re-sending an add after a partial
	// success) treats it as confirmed rather than spinning forever.
	ErrAlreadyExists = errors.New("lidarr: already exists")
	// ErrNotFound is returned by LookupArtistByMBID and LookupAlbumByMBID
	// when Lidarr returns 200 with an empty array — i.e., the MBID isn't in
	// Lidarr's monitored set. Distinguished from network/auth errors so admin
	// handlers can surface it as `lidarr_album_lookup_failed` (502) instead
	// of `lidarr_unreachable` (503).
	//
	// Aliased to apierror.ErrNotFound so handler error mapping (errors.Is
	// against the shared sentinel) and existing per-package callsites both
	// resolve to the same pointer.
	ErrNotFound = apierror.ErrNotFound
)
