export interface FMRawTrack {
	name: string;
	url: string;
	album: {
		"#text": string;
	};
	artist: {
		name: string;
	};
	image: Array<{
		size: string;
		"#text": string;
	}>;
	"@attr"?: {
		nowplaying?: string;
	};
}

export interface FMTrack {
	name: string;
	artist: string;
	album: string;
	url: string;
	albumArt: string;

}

export interface FMResponse {
	recenttracks: {
		track: FMRawTrack[];
	};
};

export function transformRawTrack(raw: FMRawTrack): FMTrack {
	return {
		name: raw.name,
		artist: raw.artist.name,
		album: raw.album["#text"],
		url: raw.url,
		albumArt: raw.image[1]["#text"]
	};
}
