using WorkFlowCheck.Common.DTO;
using WorkFlowCheck.MAUI.Pages.Media;
using WorkFlowCheck.MAUI.Services.Interfaces;
namespace WorkFlowCheck.MAUI
{
    public partial class MainPage : ContentPage
    {
        int count = 0;
        private IUserService _userService;

        public MainPage(IUserService userService)
        {
            InitializeComponent();
            _userService = userService;
        }
        //public void Initialize(IUserService userService)
        //{
        //    _userService = userService;
        //}
        //private void OnCounterClicked(object sender, EventArgs e)
        //{
        //    count++;

        //    if (count == 1)
        //        CounterBtn.Text = $"Clicked {count} time";
        //    else
        //        CounterBtn.Text = $"Clicked {count} times";

        //    SemanticScreenReader.Announce(CounterBtn.Text);
        //}
        private async void OnButtonGetUser(object sender, EventArgs e)
        {
            //var response = await _userService.GetUserAsync();
            //if (response != null)
            //{
            //    try
            //    {
            //        WelcomeLabel.Text = response.Data.FirstName;
            //    }
            //    catch (Exception ex)
            //    {

            //        WelcomeLabel.Text = ex.Message;
            //    }

            //}
            await Navigation.PushAsync(new CaptureImagePage());
        }
        private async void OnButtonNFCTest(object sender, EventArgs e)
        {
            await Shell.Current.GoToAsync("//NFCTestPage");
        }
        private async void OnButtonBaseStock(object sender, EventArgs e)
        {
            await Shell.Current.GoToAsync("//BaseStockPage");
        }
        private void OnButtonLogout(object sender, EventArgs e)
        {
            SecureStorage.Default.Remove("WFCUser");
            SecureStorage.Default.Remove("AuthToken");
            Shell.Current.GoToAsync("//LoginPage");
        }
        private void OnButtonSync(object sender, EventArgs e)
        {
            Shell.Current.GoToAsync("//SyncPage");
        }
        private async void OnButtonCheckList(object sender, EventArgs e)
        {
            await Shell.Current.GoToAsync("//CheckListPage");
        }   
    }

}
