using Example.Connectors;
using Example.Models;
using Material.Icons;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Input;

namespace Example.ViewModels
{
    public class MainViewModel : ViewModelBase
    {
        private PlayerInfoModule _playerInfoModule = GetPlayerInfo.PlayerDetails;
        private ViewModelBase _currentChildView;
        private string _windowtitle;
        private MaterialIconKind _windowIcon;


        public PlayerInfoModule playerInfoModule
        {
            get
            {
                return _playerInfoModule;
            }
            set
            {
                _playerInfoModule = value;
            }



        }

        public ViewModelBase CurrentChildView { get => _currentChildView; set { _currentChildView = value; OnPropertyChanged(nameof(CurrentChildView)); } }
        public string Windowtitle { get => _windowtitle; set { _windowtitle = value; OnPropertyChanged(nameof(Windowtitle)); } }
        public MaterialIconKind WindowIcon { get => _windowIcon; set { _windowIcon = value; OnPropertyChanged(nameof(WindowIcon)); } }

        //--> Commands
        public ICommand ShowHomeViewCommand { get; }
        public ICommand ShowProfileViewCommand { get; }

        public MainViewModel()
        {
            //Initialize Commands
            ShowHomeViewCommand = new ViewModelCommand(ExecuteShowHomeViewCommand);
            ShowProfileViewCommand = new ViewModelCommand(ExecuteShowProfileViewCommand);

            // Default View
            ExecuteShowHomeViewCommand(null);
        }

        private void ExecuteShowProfileViewCommand(object obj)
        {
            CurrentChildView = new ProfileViewModel();
            Windowtitle = "Profile";
            WindowIcon = MaterialIconKind.Person;
        }

        private void ExecuteShowHomeViewCommand(object obj)
        {
            CurrentChildView = new HomeViewModel();
            Windowtitle = "Home";
            WindowIcon = MaterialIconKind.Home;
        }
    }
}
