File size: 1,118 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
38
39
40
41
<?php

declare(strict_types=1);

namespace Billing\Application\Commands;

use Billing\Application\CommandHandlers\CountSubscriptionsCommandHandler;
use Billing\Domain\Entities\PlanEntity;
use Billing\Domain\ValueObjects\SubscriptionStatus;
use Shared\Domain\ValueObjects\Id;
use Shared\Infrastructure\CommandBus\Attributes\Handler;
use Workspace\Domain\Entities\WorkspaceEntity;

#[Handler(CountSubscriptionsCommandHandler::class)]
class CountSubscriptionsCommand
{
    public ?SubscriptionStatus $status = null;
    public null|Id|WorkspaceEntity $workspace = null;
    public null|Id|PlanEntity $plan = null;

    public function setStatus(string $status): self
    {
        $this->status = SubscriptionStatus::from($status);

        return $this;
    }

    public function setWorkspace(string|Id|WorkspaceEntity $workspace): self
    {

        $this->workspace = is_string($workspace) ? new Id($workspace) : $workspace;
        return $this;
    }

    public function setPlan(string|Id|PlanEntity $plan): self
    {
        $this->plan = is_string($plan) ? new Id($plan) : $plan;
        return $this;
    }
}