|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace kalanis\Pohoda\ListResponse; |
|
4
|
|
|
|
|
5
|
|
|
use AllowDynamicProperties; |
|
6
|
|
|
use kalanis\Pohoda\Common\Attributes; |
|
7
|
|
|
use kalanis\Pohoda\Common\Dtos\AbstractDto; |
|
8
|
|
|
use kalanis\Pohoda\Common\Enums; |
|
9
|
|
|
use kalanis\Pohoda\ListRequest; |
|
10
|
|
|
use kalanis\Pohoda\Order; |
|
11
|
|
|
use kalanis\Pohoda\Stock; |
|
12
|
|
|
use Symfony\Component\OptionsResolver\Options; |
|
13
|
|
|
|
|
14
|
|
|
#[AllowDynamicProperties] |
|
15
|
|
|
class ListResponseDto extends AbstractDto |
|
16
|
|
|
{ |
|
17
|
|
|
#[Attributes\Options\ListRequestTypeOption, Attributes\Options\RequiredOption] |
|
18
|
|
|
public ?string $type = null; |
|
19
|
|
|
public ?string $state = null; |
|
20
|
|
|
#[Attributes\Options\DefaultOption(['\kalanis\Pohoda\ListResponse\ListResponseDto', 'normalizeNamespace'])] |
|
21
|
|
|
public ?string $namespace = null; |
|
22
|
|
|
#[Attributes\Options\DefaultOption(['\kalanis\Pohoda\ListResponse\ListResponseDto', 'normalizeOrderType']), Attributes\Options\EnumOption(Enums\OrderTypeEnum::class)] |
|
23
|
|
|
public Enums\OrderTypeEnum|string|null $orderType = null; |
|
24
|
|
|
#[Attributes\Options\DefaultOption(['\kalanis\Pohoda\ListResponse\ListResponseDto', 'normalizeInvoiceType']), Attributes\Options\EnumOption(Enums\InvoiceTypeEnum::class)] |
|
25
|
|
|
public Enums\InvoiceTypeEnum|string|null $invoiceType = null; |
|
26
|
|
|
#[Attributes\JustAttribute] |
|
27
|
|
|
public ListRequest\Limit|ListRequest\LimitDto|null $limit = null; |
|
28
|
|
|
#[Attributes\JustAttribute] |
|
29
|
|
|
public ListRequest\Filter|ListRequest\FilterDto|null $filter = null; |
|
30
|
|
|
#[Attributes\JustAttribute] |
|
31
|
|
|
public ListRequest\RestrictionData|ListRequest\RestrictionDataDto|null $restrictionData = null; |
|
32
|
|
|
#[Attributes\JustAttribute] |
|
33
|
|
|
public ListRequest\UserFilterName|ListRequest\UserFilterNameDto|null $userFilterName = null; |
|
34
|
|
|
/** @var array<Order> */ |
|
35
|
|
|
public array $order = []; |
|
36
|
|
|
/** @var array<Stock> */ |
|
37
|
|
|
public array $stock = []; |
|
38
|
|
|
public \DateTimeInterface|string|null $timestamp = null; |
|
39
|
|
|
public \DateTimeInterface|string|null $validFrom = null; |
|
40
|
|
|
|
|
41
|
17 |
|
public static function normalizeNamespace(Options $options): string |
|
42
|
|
|
{ |
|
43
|
17 |
|
if ('Stock' == $options['type']) { |
|
44
|
2 |
|
return 'lStk'; |
|
45
|
|
|
} |
|
46
|
|
|
|
|
47
|
15 |
|
if ('AddressBook' == $options['type']) { |
|
48
|
1 |
|
return 'lAdb'; |
|
49
|
|
|
} |
|
50
|
|
|
/* |
|
51
|
|
|
if ('AccountingUnit' == $options['type']) { |
|
52
|
|
|
return 'acu'; |
|
53
|
|
|
} |
|
54
|
|
|
*/ |
|
55
|
14 |
|
if ('Contract' == $options['type']) { |
|
56
|
1 |
|
return 'lCon'; |
|
57
|
|
|
} |
|
58
|
|
|
/* |
|
59
|
|
|
if ('Centre' == $options['type']) { |
|
60
|
|
|
return 'lCen'; |
|
61
|
|
|
} |
|
62
|
|
|
|
|
63
|
|
|
if ('Activity' == $options['type']) { |
|
64
|
|
|
return 'lAcv'; |
|
65
|
|
|
} |
|
66
|
|
|
*/ |
|
67
|
13 |
|
return 'lst'; |
|
68
|
|
|
} |
|
69
|
|
|
|
|
70
|
17 |
|
public static function normalizeOrderType(Options $options): ?string |
|
71
|
|
|
{ |
|
72
|
17 |
|
if ('Order' == $options['type']) { |
|
73
|
2 |
|
return 'receivedOrder'; |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
15 |
|
return null; |
|
77
|
|
|
} |
|
78
|
|
|
|
|
79
|
16 |
|
public static function normalizeInvoiceType(Options $options): ?string |
|
80
|
|
|
{ |
|
81
|
16 |
|
if ('Invoice' == $options['type']) { |
|
82
|
2 |
|
return 'issuedInvoice'; |
|
83
|
|
|
} |
|
84
|
|
|
|
|
85
|
14 |
|
return null; |
|
86
|
|
|
} |
|
87
|
|
|
} |
|
88
|
|
|
|