Adds functionality for resetting customer passwords, including input and output handling.
40 lines
951 B
PHP
40 lines
951 B
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Cqs\Actions\Auth;
|
|
|
|
use App\Enums\ResetCustomerPasswordStatus;
|
|
|
|
final readonly class ResetCustomerPasswordOutput
|
|
{
|
|
private function __construct(
|
|
public ResetCustomerPasswordStatus $status,
|
|
public bool $emailVerified = false,
|
|
public ?string $errorMessage = null,
|
|
) {
|
|
}
|
|
|
|
public static function success(bool $emailVerified): self
|
|
{
|
|
return new self(
|
|
status: ResetCustomerPasswordStatus::SUCCESS,
|
|
emailVerified: $emailVerified,
|
|
);
|
|
}
|
|
|
|
public static function notEmployed(): self
|
|
{
|
|
return new self(
|
|
status: ResetCustomerPasswordStatus::NOT_EMPLOYED,
|
|
);
|
|
}
|
|
|
|
public static function invalidPassword(string $errorMessage): self
|
|
{
|
|
return new self(
|
|
status: ResetCustomerPasswordStatus::INVALID_PASSWORD,
|
|
errorMessage: $errorMessage,
|
|
);
|
|
}
|
|
}
|