namespace ShoopNCook;
using Models;
using Endpoint;
using LocalEndpoint;

public partial class App : Application, ConnectionObserver, IApp
{

    private IEndpoint Endpoint = new LocalEndpoint();

    public IUserNotifier Notifier => new ConsoleUserNotifier();

    public App()
    {
        InitializeComponent();
        ForceLogin(); //start in login shell
    }

    public void OnAccountConnected(Account account)
    {
        Shell shell = new MainAppShell(account, Endpoint, this);
        shell.GoToAsync("//Home");
        MainPage = shell;
    }

    public void ForceLogin()
    {
        Shell shell = new ConnectAppShell(this, Endpoint.AuthService, Notifier);
        shell.GoToAsync("//Splash");
        MainPage = shell;
    }
}