*/ final readonly class FindEmployee implements Usecase { public function __construct( private EmployeeDirectory $directory ) { } #[\Override] public function execute(BaseInput $input): Output { assert($input instanceof Input); $employee = $this->directory->find($input->id); if ($employee === null) { throw NotFoundException::forEntity('Employee', (string) $input->id); } return new Output( id: $employee->id(), firstName: $employee->firstName, lastName: $employee->lastName, establishment: $employee->establishment->value, site: $employee->site->value, service: $employee->service->value, startDate: $employee->startDate, endDate: $employee->endDate, plannedEndDate: $employee->plannedEndDate, ); } }