<?php

declare(strict_types=1);

namespace App\Administration\Application\Service;

use App\Administration\Domain\Model\Invitation\InvitationCode;

use function bin2hex;
use function random_bytes;

final readonly class InvitationCodeGenerator
{
    /**
     * Generates a cryptographically secure 32-character hexadecimal invitation code.
     */
    public function generate(): InvitationCode
    {
        $code = bin2hex(random_bytes(16));

        return new InvitationCode($code);
    }
}
