<?php

namespace App\SiteReadiness\Checks;

use App\SiteReadiness\CheckResult;
use App\SiteReadiness\ReadinessCheck;
use App\SiteReadiness\Status;

class DevModeCheck implements ReadinessCheck
{
    public function group(): string { return 'Environment'; }
    public function label(): string { return 'DEV_MODE is off'; }
    public function hint(): string { return 'Set DEV_MODE to false in site settings.'; }

    public function run(): CheckResult
    {
        $on = defined('DEV_MODE') && DEV_MODE;
        if (!$on) {
            return new CheckResult(Status::OK, 'DEV_MODE is off.');
        }
        $prod = config('app.env') === 'production';
        return new CheckResult($prod ? Status::FAIL : Status::WARN, 'DEV_MODE is on.');
    }
}
