namespace Model.Stub;

public class Manager
{
    public readonly static int MAX_NAME_LENGTH = 75;

    public readonly static int MAX_DESCRIPTION_LENGTH = 500;

    public readonly static string DEFAULT_NAME = "Unknown";

    public readonly static string DEFAULT_URL = "none.png";

    public readonly static string DEFAULT_DESC = "";

    public IDataManager DataManager { get; set; }

    private List<Album> albums;

    public IEnumerable<Album> Albums
    {
        get
        {
            return new List<Album>(albums);
        }
    }

    private List<CustomTitle> customTitles;

    public IEnumerable<CustomTitle> CustomTitles
    {
        get
        {
            return new List<CustomTitle>(customTitles);
        }
    }

    private List<InfoTitle> infoTitles;

    public IEnumerable<InfoTitle> InfoTitles
    {
        get
        {
            return new List<InfoTitle>(infoTitles);
        }
    }

    private List<Playlist> playlists;

    public IEnumerable<Playlist> Playlists
    {
        get
        {
            return new List<Playlist>(playlists);
        }
    }

    private List<Artist> artists;

    public IEnumerable<Artist> Artists
    {
        get
        {
            return new List<Artist>(artists);
        }
    }

    public Manager(IDataManager dataManager)
    {
        DataManager = dataManager;

        albums = DataManager.GetAlbums();
        customTitles = DataManager.GetCustomTitles();
        infoTitles = DataManager.GetInfoTitles();
        playlists = DataManager.GetPlaylists();
        artists = DataManager.GetArtists();
    }

    public void AddAlbum(Album album)
    {
        DataManager.AddAlbum(album);
        albums = DataManager.GetAlbums();
    }

    public void AddCustomTitle(CustomTitle title)
    {
        DataManager.AddCustomTitle(title);
        customTitles = DataManager.GetCustomTitles();
    }

    public void AddInfoTitle(InfoTitle title)
    {
        DataManager.AddInfoTitle(title);
        infoTitles = DataManager.GetInfoTitles();
    }

    public void AddPlaylist(Playlist playlist)
    {
        DataManager.AddPlaylist(playlist);
        playlists = DataManager.GetPlaylists();
    }

    public void AddArtist(Artist artist)
    {
        DataManager.AddArtist(artist);
        artists = DataManager.GetArtists();
    }

    public void RemoveAlbum(Album album)
    {
        DataManager.RemoveAlbum(album);
        albums = DataManager.GetAlbums();
    }

    public void RemoveCustomTitle(CustomTitle title)
    {
        DataManager.RemoveCustomTitle(title);
        customTitles = DataManager.GetCustomTitles();
    }

    public void RemoveInfoTitle(InfoTitle title)
    {
        DataManager.RemoveInfoTitle(title);
        infoTitles = DataManager.GetInfoTitles();
    }

    public void RemovePlaylist(Playlist playlist)
    {
        DataManager.RemovePlaylist(playlist);
        playlists = DataManager.GetPlaylists();
    }

    public IEnumerable<Playlist> GetPlaylists()
    {
        return DataManager.GetPlaylists();
    }

    public IEnumerable<Album> GetAlbums()
    {
        return DataManager.GetAlbums();
    }

    public IEnumerable<CustomTitle> GetCustomTitles()
    {
        return DataManager.GetCustomTitles();
    }

    public IEnumerable<InfoTitle> GetInfoTitles()
    {
        return DataManager.GetInfoTitles();
    }

    public IEnumerable<Artist> GetArtists()
    {
        return DataManager.GetArtists();
    }

    public void LoadSerialization()
    {
        DataManager.LoadSerialization();
    }

    public void SaveSerialization()
    {
        DataManager.SaveSerialization();
    }

}
