using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Music.Model;
using StructureMap;
using Web.Views.Shared;
using Music.Presentation;

namespace Web.Views.Home
{
    public partial class Index : System.Web.UI.Page, IHomeView
    {
        private IHomePagePresenter _presenter;

        protected void Page_Init(object sender, EventArgs e)
        {
            _presenter = new HomePagePresenter(this, ObjectFactory.GetInstance<SongService>());
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            _presenter.Display();
        }

        #region IHomeView Members

        public IEnumerable<Music.Model.Song> SongList
        {
            set
            {
                plSongList.SetSongsToDisplay(value);
            }
        }

        public IEnumerable<Album> AlbumList
        {
            set
            {
                // TODO: Update master page and add support for albums
            }
        }

        public IEnumerable<Artist> ArtistList
        {
            set
            {
                MusicStore musicMasterPage = (MusicStore)Page.Master;
                musicMasterPage.ArtistListControl.SetArtistsToDisplay(value);
            }
        }

        #endregion
    }
}