feat: refactor participant card DTOs and labels

This commit is contained in:
Björn Fromme
2026-04-11 18:28:32 +02:00
parent f22ceae41c
commit 1b0e479e49
10 changed files with 299 additions and 139 deletions
+43
View File
@@ -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,
) {
}
}