<?php

namespace App\Services\Certification;

/*
------------------------------------------------------------
Platform Certification
Pack 2600-B
------------------------------------------------------------
Verifies that the Enterprise Certification framework itself
is present and operational.
------------------------------------------------------------
*/

final class PlatformCertification
extends BaseCertification
{
    public static function module(): string
    {
        return 'Platform';
    }

    public static function certify(): array
    {
        $required = [

            BASE_PATH .
            '/app/services/Certification/CertificationResult.php',

            BASE_PATH .
            '/app/services/Certification/CertificationRegistry.php',

            BASE_PATH .
            '/app/services/Certification/EnterpriseCertificationEngine.php',

            BASE_PATH .
            '/app/services/Certification/CertificationContract.php',

            BASE_PATH .
            '/app/services/Certification/BaseCertification.php'

        ];

        $missing = [];

        foreach ($required as $file) {

            if (!file_exists($file)) {

                $missing[] = basename($file);

            }

        }

        if (!empty($missing)) {

            return self::fail(
                $missing
            );

        }

        return self::pass([

            'files_checked' => count($required)

        ]);
    }
}
