Files
myep/src/Form/Model/BookingDtoInterface.php
T

52 lines
1.4 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Form\Model;
/**
* Interface for unified access to booking data across create and edit workflows.
*
* This interface provides a consistent API for accessing common booking data
* regardless of whether the data comes from a creation workflow (BookingCreateDto)
* or an edit workflow (BookingEditDto). This enables code reuse and simplifies
* form field handlers and state management systems.
*/
interface BookingDtoInterface
{
public const MODE_CREATE = 'create';
public const MODE_EDIT = 'edit';
/**
* Gets the booking mode (create or edit).
*
* @return string One of MODE_CREATE or MODE_EDIT constants
*/
public function getMode(): string;
/**
* Gets all participants in the booking.
*
* @return array<int, ParticipantDto> Array of participant DTOs indexed by participant index
*/
public function getParticipants(): array;
/**
* Checks if a participant exists at the given index.
*
* @param int $index The participant index to check
*
* @return bool True if a participant exists at the given index
*/
public function hasParticipant(int $index): bool;
/**
* Gets a participant by index.
*
* @param int $index The participant index
*
* @return ParticipantDto|null The participant DTO or null if not found
*/
public function getParticipant(int $index): ?ParticipantDto;
}