#include "DatabaseManager.h"

DatabaseManager::DatabaseManager()
    : mDatabase(),
      mDatabaseInterface()
{

}

DatabaseManager::~DatabaseManager()
{

}

std::unique_ptr<DatabaseManager> DatabaseManager::Create()
{
    return std::make_unique<DatabaseManager>();
}


void DatabaseManager::CreateDatabase(const std::string& path)
{
    mDatabase = Database::Create();
    mDatabase->SetPath(path);

    mDatabaseInterface = SqliteInterface::Create();
    mDatabaseInterface->Open(mDatabase);
}

void DatabaseManager::Run(const std::string& statement)
{
    mDatabaseInterface->Run(statement);
}

void DatabaseManager::OnShutDown()
{
    if(mDatabaseInterface)
    {
        mDatabaseInterface->Close();
    }
}
