using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Collections.ObjectModel;
using DataAccessLibrary.DataAccess;
using DataAccessLibrary.Models;

namespace GolfComp.ViewModels
{
   public class SpelerListPageViewModel : INotifyPropertyChanged
    {
        ObservableCollection<SpelerViewModel> spelers = new ObservableCollection<SpelerViewModel>();
        ObservableCollection<GolfclubModel> golfclub = new ObservableCollection<GolfclubModel>();
        ObservableCollection<TeamModel> teams = new ObservableCollection<TeamModel>();
        public SpelerListPageViewModel()
        {
            
        }

        event PropertyChangedEventHandler INotifyPropertyChanged.PropertyChanged
        {
            add
            {
                throw new NotImplementedException();
            }

            remove
            {
                throw new NotImplementedException();
            }
        }

        public void GetSpelersLijst()
        {
            string sql1 = "select * from Speler ";
            var spelerlijst = SqliteDataAccess.LoadData<SpelerViewModel>(sql1, new Dictionary<string, object>());

            spelerlijst.ForEach(x => spelers.Add(x));

            
        }
        public void GetGolfclubs()
        {
            string sql2 = "select * from Golfclub ";
            var golfclublijst = SqliteDataAccess.LoadData<GolfclubModel>(sql2, new Dictionary<string, object>());

            golfclublijst.ForEach(x => golfclub.Add(x));
        }
        public void GetTeams()
        {
            string sql2 = "select * from Team ";
            var golfclublijst = SqliteDataAccess.LoadData<TeamModel>(sql2, new Dictionary<string, object>());

            golfclublijst.ForEach(x => teams.Add(x));
        }

    }

    
}
