<?php

declare(strict_types=1);

namespace App\Services\Install;

use App\Services\Install\Contracts\WebInstallMigrationCompletionGuardContract;
use DomainException;
use Illuminate\Support\Facades\Schema;

final class WebInstallSchemaMigrationCompletionGuard implements WebInstallMigrationCompletionGuardContract
{
    public function ensureRequiredTablesExist(): void
    {
        if (Schema::hasTable('users')) {
            return;
        }

        throw new DomainException(WebInstallUserMessages::MIGRATION_INCOMPLETE_TABLES);
    }
}
