use serde::{Deserialize, Serialize};

use crate::library::{album::AlbumId, artist::ArtistId, collection::CollectionId, track::TrackId};

#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
pub enum Collectable {
    Track(TrackId),
    Artist(ArtistId),
    Album(AlbumId),
    Collection(CollectionId),
}

impl Collectable {
    #[must_use]
    pub fn to_selene_id(&self) -> String {
        match self {
            Collectable::Track(track_id) => track_id.to_selene_id(),
            Collectable::Artist(artist_id) => artist_id.to_selene_id(),
            Collectable::Album(album_id) => album_id.to_selene_id(),
            Collectable::Collection(collection_id) => collection_id.to_selene_id(),
        }
    }
}
