File size: 844 Bytes
cf14c12
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
<?php

declare(strict_types=1);

namespace Assistant\Application\Commands;

use Assistant\Application\CommandHandlers\CountAssistantsCommandHandler;
use Assistant\Domain\ValueObjects\Status;
use Shared\Domain\ValueObjects\Id;
use Shared\Infrastructure\CommandBus\Attributes\Handler;

#[Handler(CountAssistantsCommandHandler::class)]
class CountAssistantsCommand
{
    public ?Status $status = null;

    /** @var null|array<Id> */
    public ?array $ids = null;

    /** Search terms/query */
    public ?string $query = null;

    public function setStatus(int $status): self
    {
        $this->status = Status::from($status);
        return $this;
    }

    public function setIds(string|Id ...$ids): void
    {
        $this->ids = array_map(
            fn($id) => is_string($id) ? new Id($id) : $id,
            $ids
        );
    }
}