selene_core/library/
collectable.rs1use serde::{Deserialize, Serialize};
2
3use crate::library::{album::AlbumId, artist::ArtistId, collection::CollectionId, track::TrackId};
4
5#[derive(Debug, Clone, Copy, Serialize, Deserialize, PartialEq)]
6pub enum Collectable {
7 Track(TrackId),
8 Artist(ArtistId),
9 Album(AlbumId),
10 Collection(CollectionId),
11}
12
13impl Collectable {
14 #[must_use]
15 pub fn to_selene_id(&self) -> String {
16 match self {
17 Collectable::Track(track_id) => track_id.to_selene_id(),
18 Collectable::Artist(artist_id) => artist_id.to_selene_id(),
19 Collectable::Album(album_id) => album_id.to_selene_id(),
20 Collectable::Collection(collection_id) => collection_id.to_selene_id(),
21 }
22 }
23}