1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
declare(strict_types=1); |
4
|
|
|
|
5
|
|
|
namespace Lamoda\IsmpClient\V3\Dto; |
6
|
|
|
|
7
|
|
|
final class FacadeDocListV2Query |
8
|
|
|
{ |
9
|
|
|
public const DOCUMENT_STATUS_IN_PROGRESS = 'IN_PROGRESS'; |
10
|
|
|
public const DOCUMENT_STATUS_CHECKED_OK = 'CHECKED_OK'; |
11
|
|
|
public const DOCUMENT_STATUS_CHECKED_NOT_OK = 'CHECKED_NOT_OK'; |
12
|
|
|
public const DOCUMENT_STATUS_PROCESSING_ERROR = 'PROCESSING_ERROR'; |
13
|
|
|
public const DOCUMENT_STATUS_UNDEFINED = 'UNDEFINED'; |
14
|
|
|
|
15
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
16
|
|
|
public const DOCUMENT_TYPE_LP_INTRODUCE_GOODS = 'LP_INTRODUCE_GOODS'; |
17
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
18
|
|
|
public const DOCUMENT_TYPE_LP_INTRODUCE_GOODS_CSV = 'LP_INTRODUCE_GOODS_CSV'; |
19
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
20
|
|
|
public const DOCUMENT_TYPE_LP_INTRODUCE_GOODS_XML = 'LP_INTRODUCE_GOODS_XML'; |
21
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
22
|
|
|
public const DOCUMENT_TYPE_LP_SHIP_GOODS = 'LP_SHIP_GOODS'; |
23
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
24
|
|
|
public const DOCUMENT_TYPE_LP_SHIP_GOODS_XML = 'LP_SHIP_GOODS_XML'; |
25
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
26
|
|
|
public const DOCUMENT_TYPE_LP_ACCEPT_GOODS = 'LP_ACCEPT_GOODS'; |
27
|
|
|
/** @deprecated use DocumentLkType constants instead */ |
28
|
|
|
public const DOCUMENT_TYPE_LP_ACCEPT_GOODS_XML = 'LP_ACCEPT_GOODS_XML'; |
29
|
|
|
|
30
|
|
|
public const ORDER_ASC = 'ASC'; |
31
|
|
|
public const ORDER_DESC = 'DESC'; |
32
|
|
|
|
33
|
|
|
public const ORDER_COLUMN_DOC_DATE = 'docDate'; |
34
|
|
|
public const ORDER_COLUMN_RECEIVED_AT = 'receivedAt'; |
35
|
|
|
|
36
|
|
|
public const PAGE_DIR_NEXT = 'NEXT'; |
37
|
|
|
public const PAGE_DIR_PREV = 'PREV'; |
38
|
|
|
|
39
|
|
|
/** |
40
|
|
|
* @var \DateTimeInterface | null |
41
|
|
|
*/ |
42
|
|
|
private $dateFrom; |
43
|
|
|
/** |
44
|
|
|
* @var \DateTimeInterface | null |
45
|
|
|
*/ |
46
|
|
|
private $dateTo; |
47
|
|
|
/** |
48
|
|
|
* @var string|null |
49
|
|
|
*/ |
50
|
|
|
private $number; |
51
|
|
|
/** |
52
|
|
|
* @var string|null |
53
|
|
|
*/ |
54
|
|
|
private $documentStatus; |
55
|
|
|
/** |
56
|
|
|
* @var string|null |
57
|
|
|
*/ |
58
|
|
|
private $documentType; |
59
|
|
|
/** |
60
|
|
|
* @var bool | null |
61
|
|
|
*/ |
62
|
|
|
private $inputFormat; |
63
|
|
|
/** |
64
|
|
|
* @var string|null |
65
|
|
|
*/ |
66
|
|
|
private $participantInn; |
67
|
|
|
/** |
68
|
|
|
* @var string|null |
69
|
|
|
*/ |
70
|
|
|
private $order; |
71
|
|
|
/** |
72
|
|
|
* @var string|null |
73
|
|
|
*/ |
74
|
|
|
private $did; |
75
|
|
|
/** |
76
|
|
|
* @var string|null |
77
|
|
|
*/ |
78
|
|
|
private $orderedColumnValue; |
79
|
|
|
/** |
80
|
|
|
* @var string|null |
81
|
|
|
*/ |
82
|
|
|
private $orderColumn; |
83
|
|
|
/** |
84
|
|
|
* @var string|null |
85
|
|
|
*/ |
86
|
|
|
private $pageDir; |
87
|
|
|
/** |
88
|
|
|
* @var int |
89
|
|
|
*/ |
90
|
|
|
private $limit = 10; |
91
|
|
|
|
92
|
|
|
public function getDateFrom(): ?\DateTimeInterface |
93
|
|
|
{ |
94
|
|
|
return $this->dateFrom; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function setDateFrom(?\DateTimeInterface $dateFrom): void |
98
|
|
|
{ |
99
|
|
|
$this->dateFrom = $dateFrom; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function getDateTo(): ?\DateTimeInterface |
103
|
|
|
{ |
104
|
|
|
return $this->dateTo; |
105
|
|
|
} |
106
|
|
|
|
107
|
|
|
public function setDateTo(?\DateTimeInterface $dateTo): void |
108
|
|
|
{ |
109
|
|
|
$this->dateTo = $dateTo; |
110
|
|
|
} |
111
|
|
|
|
112
|
|
|
public function getNumber(): ?string |
113
|
|
|
{ |
114
|
|
|
return $this->number; |
115
|
|
|
} |
116
|
|
|
|
117
|
|
|
public function setNumber(?string $number): void |
118
|
|
|
{ |
119
|
|
|
$this->number = $number; |
120
|
|
|
} |
121
|
|
|
|
122
|
|
|
public function getDocumentStatus(): ?string |
123
|
|
|
{ |
124
|
|
|
return $this->documentStatus; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function setDocumentStatus(?string $documentStatus): void |
128
|
|
|
{ |
129
|
|
|
$this->documentStatus = $documentStatus; |
130
|
|
|
} |
131
|
|
|
|
132
|
|
|
public function getDocumentType(): ?string |
133
|
|
|
{ |
134
|
|
|
return $this->documentType; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function setDocumentType(?string $documentType): void |
138
|
|
|
{ |
139
|
|
|
$this->documentType = $documentType; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function getInputFormat(): ?bool |
143
|
|
|
{ |
144
|
|
|
return $this->inputFormat; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function setInputFormat(?bool $inputFormat): void |
148
|
|
|
{ |
149
|
|
|
$this->inputFormat = $inputFormat; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function getParticipantInn(): ?string |
153
|
|
|
{ |
154
|
|
|
return $this->participantInn; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function setParticipantInn(?string $participantInn): void |
158
|
|
|
{ |
159
|
|
|
$this->participantInn = $participantInn; |
160
|
|
|
} |
161
|
|
|
|
162
|
|
|
public function getOrder(): ?string |
163
|
|
|
{ |
164
|
|
|
return $this->order; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
public function setOrder(?string $order): void |
168
|
|
|
{ |
169
|
|
|
$this->order = $order; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
public function getDid(): ?string |
173
|
|
|
{ |
174
|
|
|
return $this->did; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function setDid(?string $did): void |
178
|
|
|
{ |
179
|
|
|
$this->did = $did; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public function getOrderedColumnValue(): ?string |
183
|
|
|
{ |
184
|
|
|
return $this->orderedColumnValue; |
185
|
|
|
} |
186
|
|
|
|
187
|
|
|
public function setOrderedColumnValue(?string $orderedColumnValue): void |
188
|
|
|
{ |
189
|
|
|
$this->orderedColumnValue = $orderedColumnValue; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
public function getOrderColumn(): ?string |
193
|
|
|
{ |
194
|
|
|
return $this->orderColumn; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
public function setOrderColumn(?string $orderColumn): void |
198
|
|
|
{ |
199
|
|
|
$this->orderColumn = $orderColumn; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
public function getPageDir(): ?string |
203
|
|
|
{ |
204
|
|
|
return $this->pageDir; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
public function setPageDir(?string $pageDir): void |
208
|
|
|
{ |
209
|
|
|
$this->pageDir = $pageDir; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
public function getLimit(): int |
213
|
|
|
{ |
214
|
|
|
return $this->limit; |
215
|
|
|
} |
216
|
|
|
|
217
|
|
|
public function setLimit(int $limit): void |
218
|
|
|
{ |
219
|
|
|
$this->limit = $limit; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
public function toQueryArray(): array |
223
|
|
|
{ |
224
|
|
|
$query = []; |
225
|
|
|
|
226
|
|
|
self::appendIfNotNull($query, 'dateTo', $this->dateTo, static function (\DateTimeInterface $value) { |
227
|
|
|
return $value->format(DATE_RFC3339_EXTENDED); |
228
|
|
|
}); |
229
|
|
|
self::appendIfNotNull($query, 'dateFrom', $this->dateFrom, static function (\DateTimeInterface $value) { |
230
|
|
|
return $value->format(DATE_RFC3339_EXTENDED); |
231
|
|
|
}); |
232
|
|
|
self::appendIfNotNull($query, 'number', $this->number); |
233
|
|
|
self::appendIfNotNull($query, 'documentStatus', $this->documentStatus); |
234
|
|
|
self::appendIfNotNull($query, 'documentType', $this->documentType); |
235
|
|
|
self::appendIfNotNull($query, 'inputFormat', $this->inputFormat, static function (bool $value) { |
236
|
|
|
return $value ? 'true' : 'false'; |
237
|
|
|
}); |
238
|
|
|
self::appendIfNotNull($query, 'participantInn', $this->participantInn); |
239
|
|
|
self::appendIfNotNull($query, 'order', $this->order); |
240
|
|
|
self::appendIfNotNull($query, 'did', $this->did); |
241
|
|
|
self::appendIfNotNull($query, 'orderedColumnValue', $this->orderedColumnValue); |
242
|
|
|
self::appendIfNotNull($query, 'orderColumn', $this->orderColumn); |
243
|
|
|
self::appendIfNotNull($query, 'pageDir', $this->pageDir); |
244
|
|
|
self::appendIfNotNull($query, 'limit', $this->limit); |
245
|
|
|
|
246
|
|
|
return $query; |
247
|
|
|
} |
248
|
|
|
|
249
|
|
|
private static function appendIfNotNull(array &$query, string $name, $value, callable $formatter = null): void |
250
|
|
|
{ |
251
|
|
|
if ($value !== null) { |
252
|
|
|
$query[$name] = $formatter ? $formatter($value) : $value; |
253
|
|
|
} |
254
|
|
|
} |
255
|
|
|
} |
256
|
|
|
|