#include "mod_eternal_bond.h"
#include "Chat.h"
#include "Config.h"
#include "Log.h"
#include "ScriptMgr.h"

using namespace Acore::ChatCommands;

// v0: hello-world stub. Proves the module loads, its config flag is readable, and a command
// registers and responds -- no proposal/ceremony gameplay yet. See PLAN.md for the actual
// roadmap (consent handshake, quest chain, officiant ceremony, spouse recall).

class EternalBondCommandScript : public CommandScript
{
public:
    EternalBondCommandScript() : CommandScript("EternalBondCommandScript") { }

    ChatCommandTable GetCommands() const override
    {
        static ChatCommandTable commandTable =
        {
            { "eternalbond", HandleEternalBondCommand, SEC_PLAYER, Console::No },
        };

        return commandTable;
    }

    static bool HandleEternalBondCommand(ChatHandler* handler)
    {
        if (!sConfigMgr->GetOption("EternalBond.Enable", true))
        {
            handler->PSendSysMessage("The Eternal Bond module is currently disabled.");
            return true;
        }

        handler->PSendSysMessage("A matchmaker smiles knowingly: 'The rings aren't ready yet, but soon (TM).'");
        return true;
    }
};

class EternalBond_World : public WorldScript
{
public:
    EternalBond_World() : WorldScript("EternalBond_World") { }

    void OnStartup() override
    {
        LOG_INFO("server.loading", "mod-eternal-bond: loaded (v0 hello-world stub, enabled={}).",
            sConfigMgr->GetOption("EternalBond.Enable", true));
    }
};

void AddSC_mod_eternal_bond()
{
    new EternalBondCommandScript();
    new EternalBond_World();
}