<?php
class SequenceGenerator
{
    public static function next(string $sequenceName): ?string
    {
        $db = Database::getInstance();
        $db->execute("CALL sp_generate_next_sequence(?, @next_val)", [$sequenceName]);
        $result = $db->fetchOne("SELECT @next_val AS val");
        return $result['val'] ?? null;
    }
}