namespace Model
{
    public class Album 
    {
        public string Name
        {
            get => name;

            set
            {
                if (value != null && value.Length < 75)
                {
                    name = value;
                }
            }
        }

        private string name;

        public string Description
        {
            get => description;

            set
            {
                if (value != null && value.Length < 500)
                {
                    description = value;
                }
            }
        }

        private string description;

        public IEnumerable<Title> Titles { get; set; }

        public string ImageURL
        {
            get => imageURL;

            set
            {
                if (value != null && value.Contains('.'))
                {
                    imageURL = value;
                }
            }
        }

        private string imageURL;

        public Artiste Artist { get; set; }

        public string Information
        {
            get => information;

            set
            {
                if (value != null && value.Length < 500)
                {
                    information = value;
                }
            }
        }

        private string information;

        public Album(string name, string file_Name, Artiste artist, string description, string information)
        {
            Name = name;
            ImageURL = file_Name;
            Artist = artist;
            Description = description;
            Information = information;
            Titles = new List<Title>();
        }

        public void AddTitle(Title title)
        {
            Titles.Prepend(title);
        }

        public void RemoveTitle(Title title)
        {
            foreach(var item in Titles)
            {
                Titles = Titles.Where(item => item != title).ToList();
            }
        }

    }
}