<?php

namespace App\Modules\WebContactMessage\Application\ListGeneral;

use App\Modules\WebContactMessage\Domain\ListGeneralWebContactMessage;
use App\Modules\WebContactMessage\Domain\WebContactMessageRepository;

final class WebContactMessageGeneralLister
{
    public function __construct(private WebContactMessageRepository $repository) {}

    public function __invoke(
        string $search,
    ): ListGeneralWebContactMessageQueryResponse {
        return new ListGeneralWebContactMessageQueryResponse(
            $this->repository->search(
                new ListGeneralWebContactMessage(
                    $search
                )
            )
        );
    }
}
