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

namespace Web.Views.Playlist
{
    public partial class Playlist : System.Web.UI.Page, IPlaylistView
    {
        private IPlaylistPresenter _presenter;

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

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

        #region IPlaylistView Members

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

        public IEnumerable<Music.Model.Album> AlbumList
        {
            set
            {
                throw new NotImplementedException();
            }
        }

        public IEnumerable<Music.Model.Song> PlaylistItems
        {
            set
            {
                rptPlaylist.DataSource = value;
                rptPlaylist.DataBind();
            }
        }

        #endregion
    }
}