use std::future::Future; use crate::error::DataResult; use crate::types::{ ArtistInfo, ArtistSearchResult, DiscographyEntry, LyricsResult, PopularTrack, RecordingDetails, RecordingMatch, ReleaseGroupEntry, ReleaseMatch, ReleaseTrack, SimilarArtist, }; /// Trait for metadata lookup backends. MusicBrainz is the default implementation; /// others (Last.fm, Discogs, etc.) can be added later. pub trait MetadataFetcher: Send + Sync { fn search_recording( &self, artist: &str, title: &str, ) -> impl Future>> + Send; fn search_release( &self, artist: &str, album: &str, ) -> impl Future>> + Send; fn get_recording( &self, mbid: &str, ) -> impl Future> + Send; fn search_artist( &self, query: &str, limit: u32, ) -> impl Future>> + Send; fn get_artist_releases( &self, artist_mbid: &str, limit: u32, ) -> impl Future>> + Send; fn get_release_tracks( &self, release_mbid: &str, ) -> impl Future>> + Send; /// Get deduplicated release groups (albums, EPs, singles) for an artist. fn get_artist_release_groups( &self, artist_mbid: &str, ) -> impl Future>> + Send; /// Resolve a release-group MBID to a concrete release MBID (first release in the group). fn resolve_release_from_group( &self, release_group_mbid: &str, ) -> impl Future> + Send; } /// Fetches artist image URLs from an external source. pub trait ArtistImageFetcher: Send + Sync { /// Thumbnail/profile image for the artist. fn get_artist_image( &self, artist_info: &ArtistInfo, ) -> impl Future>> + Send; /// Wide banner/background image for the artist (e.g., 1920x1080). /// Returns None by default — providers that don't support banners need not implement this. fn get_artist_banner( &self, artist_info: &ArtistInfo, ) -> impl Future>> + Send { let _ = artist_info; async { Ok(None) } } } /// Fetches an artist biography from an external source. pub trait ArtistBioFetcher: Send + Sync { fn get_artist_bio( &self, artist_info: &ArtistInfo, ) -> impl Future>> + Send; } /// Fetches song lyrics from an external source. pub trait LyricsFetcher: Send + Sync { fn get_lyrics( &self, artist: &str, title: &str, ) -> impl Future> + Send; } /// Fetches similar artists and top tracks from an external source (e.g. Last.fm). pub trait SimilarArtistFetcher: Send + Sync { fn get_similar_artists( &self, artist_name: &str, mbid: Option<&str>, ) -> impl Future>> + Send; fn get_top_tracks( &self, artist_name: &str, mbid: Option<&str>, ) -> impl Future>> + Send; } /// Fetches cover art URLs for releases. pub trait CoverArtFetcher: Send + Sync { fn get_cover_art_url(&self, release_id: &str) -> Option; }