feat: refactor participant card DTOs and labels
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
/**
|
||||
* Typed participant card payload for create/edit overview rendering.
|
||||
*/
|
||||
final class ParticipantCardDataDto
|
||||
{
|
||||
/**
|
||||
* @param array<string> $errorMessages
|
||||
*/
|
||||
public function __construct(
|
||||
public readonly string $name,
|
||||
public readonly string $email,
|
||||
public readonly string $roomName,
|
||||
public readonly ParticipantCardPriceDto $price,
|
||||
public readonly bool $isCanceled,
|
||||
public readonly bool $isValid = true,
|
||||
public readonly array $errorMessages = [],
|
||||
) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a copy with validation state applied.
|
||||
*
|
||||
* @param array<string> $errorMessages
|
||||
*/
|
||||
public function withValidation(bool $isValid, array $errorMessages): self
|
||||
{
|
||||
return new self(
|
||||
name: $this->name,
|
||||
email: $this->email,
|
||||
roomName: $this->roomName,
|
||||
price: $this->price,
|
||||
isCanceled: $this->isCanceled,
|
||||
isValid: $isValid,
|
||||
errorMessages: $errorMessages,
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace App\Form\Model;
|
||||
|
||||
/**
|
||||
* Typed price display state for a participant card.
|
||||
*/
|
||||
final class ParticipantCardPriceDto
|
||||
{
|
||||
public function __construct(
|
||||
public readonly ?float $amount,
|
||||
public readonly bool $showDash,
|
||||
) {
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user