Files
Verde-Web/app/Services/Otp/OtpIssueResult.php
admin dc297d4cd7 feat(backend): complete Module 1 auth (register/login/OTP/reset)
Closes Module 1: 9 auth endpoints under /api/v1/auth, OTP via SMS
(Semaphore + log + fake drivers), role middleware, role + admin seeders,
27 feature tests passing.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-04-29 21:46:53 +08:00

28 lines
708 B
PHP

<?php
namespace App\Services\Otp;
use App\Models\OtpCode;
use App\Services\Sms\SmsResult;
class OtpIssueResult
{
public function __construct(
public readonly bool $issued,
public readonly ?OtpCode $otp = null,
public readonly ?string $plainCode = null,
public readonly ?SmsResult $smsResult = null,
public readonly int $retryAfterSeconds = 0,
) {}
public static function issued(OtpCode $otp, string $plainCode, ?SmsResult $smsResult): self
{
return new self(true, $otp, $plainCode, $smsResult);
}
public static function throttled(int $retryAfter): self
{
return new self(false, retryAfterSeconds: $retryAfter);
}
}