#pragma once

#include <Wt/Auth/Login>
#include <Wt/WEnvironment>

namespace eedb::auth {
class PgUserAuth;
}

namespace eedb::db {
class PgConnection;
};

namespace Wt::Auth {
class AbstractUserDatabase;
}
namespace eedb {

class Session {
  public:
    virtual ~Session() = default;

    virtual eedb::db::PgConnection & db()               = 0;
    virtual const Wt::WEnvironment & enviroment() const = 0;
    virtual Wt::Auth::Login & login()                   = 0;
};

class WebSession final : public Session {
  public:
    WebSession(std::unique_ptr< eedb::db::PgConnection > dbConnection, const Wt::WEnvironment & env);

    eedb::db::PgConnection & db() override;
    const Wt::WEnvironment & enviroment() const override;
    Wt::Auth::Login & login() override;

  private:
    std::unique_ptr< eedb::db::PgConnection > _dbConnection;
    Wt::Auth::Login _login;
    const Wt::WEnvironment & _env;
};
}
