using Gremlin.Models;
using System.Windows;

namespace Gremlin.GremlinUI
{
    public partial class Login : Window
    {
        //private readonly QuoteUI quoteUI = new();
        private readonly MainWindow mainWindow = new();

        public Login()
        {
            InitializeComponent();
        }

        private void BtnBeenden_Click(object sender, RoutedEventArgs e)
        {
            Application.Current.Shutdown();
        }

        private void BtnLogin_Click(object sender, RoutedEventArgs e)
        {
            _ = RegisteredUserModel.CheckLogin(tbUserName.Text, tbPassword.Password)
                ? MessageBox.Show($"Login als {tbUserName.Text} erfolgreich.", "Login succeded!", MessageBoxButton.OK, MessageBoxImage.Information)
                : MessageBox.Show("Login Name oder Passwort falsch!", "Login failed!", MessageBoxButton.OK, MessageBoxImage.Error);
            Close();
            //quoteUI.Show();
            mainWindow.Show();
        }
    }
}
