using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using UI.Services;

namespace UI
{
    /// <summary>
    /// Interaction logic for MainWindow.xaml
    /// </summary>
    public partial class MainWindow : Window
    {
        public MainWindow()
        {
            InitializeComponent();
        }
        private void Window_MouseDown(object sender, MouseButtonEventArgs e)
        {
            if (e.LeftButton == MouseButtonState.Pressed)
            {
                DragMove();
            }
        }//Movimentando o formulario

        private void BtnFechar_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }//fechar aplicativo

        private void BtnEntrar_Click(object sender, RoutedEventArgs e)
        {
            string email = TxtEmail.Text;
            string senha = PboxSenha.Password;

            if (string.IsNullOrWhiteSpace(email) || string.IsNullOrWhiteSpace(senha))
            {
                MessageBox.Show("Informe email e senha.");
                return;
            }

            bool login = AuthService.Login(email, senha);

            if (login)
            {
                MessageBox.Show("Login realizado com sucesso!");

                // abrir dashboard futuramente
                // new Dashboard().Show();
                // this.Close();
            }
            else
            {
                MessageBox.Show("Usuário ou senha inválidos.");
            }
        }

        private void BtnMostrarSenha_Click(object sender, RoutedEventArgs e)
        {

        }

        private void BtnConfiguracoes_Click(object sender, RoutedEventArgs e)
        {
            PopupConfiguracoes.IsOpen = !PopupConfiguracoes.IsOpen;
        }

        private void MenuAparencia_Click(object sender, RoutedEventArgs e)
        {
            var dh = new UI.Dashboard.DashboardMain();
            dh.ShowDialog();
        }

        private void MenuConexao_Click(object sender, RoutedEventArgs e)
        {
            var db = new UI.Configuracao.ConfiguracaoBanco();
            db.ShowDialog();
        }

        private void MenuIdioma_Click(object sender, RoutedEventArgs e)
        {

        }

        private void MenuSobre_Click(object sender, RoutedEventArgs e)
        {

        }
    }
}