#include <functional>
#include <memory>

#include <Wt/WApplication>

namespace Wt {
class WContainerWidget;
}

namespace eedb {
class AuthPage;
class HomePage;
class Session;
class Theme;

using AuthPageFactory = std::function< std::unique_ptr< AuthPage >() >;
using HomePageFactory = std::function< std::unique_ptr< HomePage >() >;

class EEDB : public Wt::WApplication {
  public:
    enum class LoginState { weak, strong };
    EEDB(std::unique_ptr< eedb::Session > session, AuthPageFactory authPageFactory, HomePageFactory homePageFactory);

    void authEventLogin(LoginState state);

    void authEventLogout();

  private:
    std::unique_ptr< eedb::Session > _session;
    std::unique_ptr< eedb::Theme > _theme;

    AuthPageFactory _authPageFactory;
    std::unique_ptr< eedb::AuthPage > _authPage;

    HomePageFactory _homePageFactory;
    std::unique_ptr< eedb::HomePage > _homePage;
};
}
