ldc-cocotte/app/Cqs/Actions/Auth/ResetCustomerPasswordOutput.php

41 lines
951 B
PHP
Raw Permalink Normal View History

<?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,
);
}
}