use lunar_lib::database::Id;

use crate::library::{album::Album, artist::Artist, track::Track};

// Unsafe one-way helpers
pub(crate) fn album_remove_track(album: &mut Album, track: Id<Track>) {
    album.tracks.retain(|t| t.id != track);
}

pub(crate) fn track_set_album(track: &mut Track, album: Option<Id<Album>>) {
    track.metadata.album = album;
}

pub(crate) fn artist_remove_track(artist: &mut Artist, track_id: Id<Track>) {
    artist.tracks.retain(|t| *t != track_id);
}
