<?php

namespace classes;

require_once WD . '/interfaces/universal_module_i.php';
require_once WD . '/modules/coolify/coolify_c.php';

use Exception;
use interfaces\universal_module_i;
use modules\coolify\coolify_c;

class coolify implements universal_module_i
{
    public coolify_c $config;

    public function __construct()
    {
        $this->config = new coolify_c();
    }

    /**
     * @throws Exception
     */
    public function requireModuleEnabled(): void
    {
        if (!$this->config->enabled->isTrue()) {
            throw new Exception('The Coolify module is not enabled');
        }
    }

    public function isEnabled(): bool
    {
        try {
            return $this->config->enabled->isTrue();
        } catch (Exception) {
            return false;
        }
    }
}
