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

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

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