export const songGetters = {
    getTitle: (song: any) => song.title,
    getId: (song: any) => song.songId,
    getArtistNames: (song: any) => song.artists.map((a: any) => a.name),
    getArtistIds: (song: any) => song.artists.map((a: any) => a.artistId),
    getAlbumNames: (song: any) => song.albums.map((a: any) => a.name),
    getAlbumIds: (song: any) => song.albums.map((a: any) => a.albumId),
    getTagNames: (song: any) => {
        // Recursively resolve the name.
        const resolveTag = (tag: any) => {
            var r = [tag.name];
            if (tag.parent) { r.unshift(resolveTag(tag.parent)); }
            return r;
        }

        return song.tags.map((tag: any) => resolveTag(tag));
    },
    getTagIds: (song: any) => {
        // Recursively resolve the id.
        const resolveTag = (tag: any) => {
            var r = [tag.tagId];
            if (tag.parent) { r.unshift(resolveTag(tag.parent)); }
            return r;
        }

        return song.tags.map((tag: any) => resolveTag(tag));
    },
}