<?php

namespace App\SiteReadiness\Checks;

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

class AppEnvCheck implements ReadinessCheck
{
    public function group(): string { return 'Environment'; }
    public function label(): string { return 'APP_ENV set for production'; }
    public function hint(): string { return 'Set APP_ENV=production on the live server.'; }

    public function run(): CheckResult
    {
        if (config('app.env') === 'production') {
            return new CheckResult(Status::OK, 'Running as production.');
        }
        return new CheckResult(Status::WARN, "APP_ENV is '" . config('app.env') . "'.");
    }
}
