using Model;
using Model.Serialization;
using Model.Stub;

IDataManager DataManager = new StubManager();

Manager Manager = new Manager(DataManager);

Manager.AddPlaylist(new Playlist("MegaTeuf", "DescPlaylist", "ImagePlaylist"));

Playlist p1 = Manager.Playlists.First();

Title? current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

p1.Loop = true;
p1.AddTitle(new CustomTitle("Nouveau", "img.png", "infos", "path.mp3"));
p1.Shuffle = true;
Console.WriteLine("--------------------");

p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);


Console.WriteLine("--------------------");

p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

Console.WriteLine("--------------------");

p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.NextTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

// Quand aléatoire et que retour arrière puis retour avant, musique aléatoire et non celle de base

Console.WriteLine("--------------------");

p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);
p1.PreviousTitle();
current = p1.GetCurrentTitle();
Console.WriteLine(current?.Name);

Manager.LoadSerialization();
foreach (var p in Manager.GetPlaylists())
{
    Console.WriteLine(p.Name);
}
foreach (var a in Manager.GetAlbums())
{
    Console.WriteLine(a.Name);
}
foreach (var a in Manager.GetArtists())
{
    Console.WriteLine(a.Name);
}
foreach (var ct in Manager.GetCustomTitles())
{
    Console.WriteLine(ct.Name);
}
foreach (var it in Manager.GetInfoTitles())
{
    Console.WriteLine(it.Name);
}
Artist newArtist = new Artist();
Manager.AddArtist(newArtist);
Manager.AddAlbum(new Album("Nouvel album", "nouveau.png", newArtist, "nouvelle desc", "nouvelles infos"));
Console.WriteLine("------");
foreach (var a in Manager.GetAlbums())
{
    Console.WriteLine(a.Name);
}
Manager.SaveSerialization();