<?php

namespace App\Http\Controllers\Admin;

use App\SiteReadiness\Checks;
use App\SiteReadiness\ReadinessReport;
use Illuminate\Routing\Controller as BaseController;

class SiteReadinessController extends BaseController
{
    public function index()
    {
        $coreChecks = [
            new Checks\AppEnvCheck(),
            new Checks\AppDebugCheck(),
            new Checks\AppKeyCheck(),
            new Checks\DevModeCheck(),
            new Checks\EncryptionEnabledCheck(),
            new Checks\AppUrlCheck(),
            new Checks\ComposerLockTrackedCheck(),
            new Checks\MailConfiguredCheck(),
            new Checks\SiteEmailsSetCheck(),
            new Checks\SiteIdentityCheck(),
            new Checks\RecaptchaConfiguredCheck(),
            new Checks\AnalyticsIdCheck(),
            new Checks\PaymentGatewayLiveModeCheck(),
            new Checks\RobotsTxtCheck(),
        ];

        $report = (new ReadinessReport($coreChecks))->run();

        return template('admin/site_readiness/index.twig', [
            'title'   => 'Site Readiness',
            'groups'  => $report['groups'],
            'summary' => $report['summary'],
        ]);
    }
}
