*/ final readonly class GetCrmCustomerQuery implements Query { public function __construct( private CrmService $crmService, private AppCustomerAuthService $authService, ) { } public function __invoke(QueryInput $input): GetCrmCustomerQueryOutput { Assert::isAOf( $input, GetCrmCustomerQueryInput::class, ); $hashcode = $input->fromHashcodeOrAuthenticatedUserHashcode ?? $this->authService->getCustomerAsMandatory()->hashcode; $crmCustomer = $this->crmService->getCustomerFromHashCode( $hashcode ); return new GetCrmCustomerQueryOutput($crmCustomer); } }