|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @author SignpostMarv |
|
4
|
|
|
*/ |
|
5
|
|
|
declare(strict_types=1); |
|
6
|
|
|
|
|
7
|
|
|
namespace SignpostMarv\DaftObject\SchemaOrg\Intangible\Service\FinancialProduct; |
|
8
|
|
|
|
|
9
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\DaftObjectTraits; |
|
10
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Quantity\Duration; |
|
11
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\Service\FinancialProduct as Base; |
|
12
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\MonetaryAmount; |
|
13
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\QuantitativeValue; |
|
14
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\Intangible\StructuredValue\RepaymentSpecification; |
|
15
|
|
|
use SignpostMarv\DaftObject\SchemaOrg\TypeUtilities; |
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* @property array<int, string> $currency |
|
19
|
|
|
* @property array<int, int|float|MonetaryAmount> $amount |
|
20
|
|
|
* @property array<int, Duration> $gracePeriod |
|
21
|
|
|
* @property array<int, RepaymentSpecification> $loanRepaymentForm |
|
22
|
|
|
* @property array<int, QuantitativeValue> $loanTerm |
|
23
|
|
|
* @property array<int, string> $loanType |
|
24
|
|
|
* @property array<int, bool> $recourseLoan |
|
25
|
|
|
* @property array<int, bool> $renegotiableLoan |
|
26
|
|
|
* @property array<int, string> $requiredCollateral |
|
27
|
|
|
*/ |
|
28
|
|
|
class LoanOrCredit extends Base |
|
29
|
|
|
{ |
|
30
|
|
|
use DaftObjectTraits\Currency; |
|
31
|
|
|
|
|
32
|
|
|
const SCHEMA_ORG_TYPE = 'LoanOrCredit'; |
|
33
|
|
|
|
|
34
|
|
|
const PROPERTIES = [ |
|
35
|
|
|
'amount', |
|
36
|
|
|
'currency', |
|
37
|
|
|
'gracePeriod', |
|
38
|
|
|
'loanRepaymentForm', |
|
39
|
|
|
'loanTerm', |
|
40
|
|
|
'loanType', |
|
41
|
|
|
'recourseLoan', |
|
42
|
|
|
'renegotiableLoan', |
|
43
|
|
|
'requiredCollateral', |
|
44
|
|
|
]; |
|
45
|
|
|
|
|
46
|
|
|
const PROPERTIES_WITH_MULTI_TYPED_ARRAYS = [ |
|
47
|
|
|
'amount' => [ |
|
48
|
|
|
'integer', |
|
49
|
|
|
'double', |
|
50
|
|
|
MonetaryAmount::class, |
|
51
|
|
|
], |
|
52
|
|
|
'gracePeriod' => [ |
|
53
|
|
|
Duration::class, |
|
54
|
|
|
], |
|
55
|
|
|
'loanRepaymentForm' => [ |
|
56
|
|
|
RepaymentSpecification::class, |
|
57
|
|
|
], |
|
58
|
|
|
'loanTerm' => [ |
|
59
|
|
|
QuantitativeValue::class, |
|
60
|
|
|
], |
|
61
|
|
|
'loanType' => [ |
|
62
|
|
|
'string', |
|
63
|
|
|
], |
|
64
|
|
|
'recourseLoan' => [ |
|
65
|
|
|
'boolean', |
|
66
|
|
|
], |
|
67
|
|
|
'renegotiableLoan' => [ |
|
68
|
|
|
'boolean', |
|
69
|
|
|
], |
|
70
|
|
|
'requiredCollateral' => [ |
|
71
|
|
|
'string', |
|
72
|
|
|
], |
|
73
|
|
|
]; |
|
74
|
|
|
|
|
75
|
|
|
/** |
|
76
|
|
|
* @return array<int, int|float|MonetaryAmount> |
|
77
|
|
|
*/ |
|
78
|
5 |
|
public function GetAmount() : array |
|
79
|
|
|
{ |
|
80
|
|
|
/** |
|
81
|
|
|
* @var array<int, int|float|MonetaryAmount> |
|
82
|
|
|
*/ |
|
83
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
84
|
5 |
|
'amount', |
|
85
|
5 |
|
$this->RetrievePropertyValueFromData('amount'), |
|
86
|
5 |
|
static::class |
|
87
|
|
|
); |
|
88
|
|
|
|
|
89
|
5 |
|
return $out; |
|
90
|
|
|
} |
|
91
|
|
|
|
|
92
|
|
|
/** |
|
93
|
|
|
* @param array<int, int|float|MonetaryAmount> $value |
|
94
|
|
|
*/ |
|
95
|
1 |
|
public function SetAmount(array $value) : void |
|
96
|
|
|
{ |
|
97
|
1 |
|
$this->NudgePropertyWithUniqueNumericsOrThings( |
|
98
|
1 |
|
'amount', |
|
99
|
1 |
|
__METHOD__, |
|
100
|
1 |
|
$value, |
|
101
|
1 |
|
MonetaryAmount::class |
|
102
|
|
|
); |
|
103
|
1 |
|
} |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @return array<int, Duration> |
|
107
|
|
|
*/ |
|
108
|
5 |
|
public function GetGracePeriod() : array |
|
109
|
|
|
{ |
|
110
|
|
|
/** |
|
111
|
|
|
* @var array<int, Duration> |
|
112
|
|
|
*/ |
|
113
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
114
|
5 |
|
'gracePeriod', |
|
115
|
5 |
|
$this->RetrievePropertyValueFromData('gracePeriod'), |
|
116
|
5 |
|
static::class |
|
117
|
|
|
); |
|
118
|
|
|
|
|
119
|
5 |
|
return $out; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
/** |
|
123
|
|
|
* @param array<int, Duration> $value |
|
124
|
|
|
*/ |
|
125
|
1 |
|
public function SetGracePeriod(array $value) : void |
|
126
|
|
|
{ |
|
127
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
128
|
1 |
|
'gracePeriod', |
|
129
|
1 |
|
__METHOD__, |
|
130
|
1 |
|
$value, |
|
131
|
1 |
|
Duration::class |
|
132
|
|
|
); |
|
133
|
1 |
|
} |
|
134
|
|
|
|
|
135
|
|
|
/** |
|
136
|
|
|
* @return array<int, RepaymentSpecification> |
|
137
|
|
|
*/ |
|
138
|
5 |
|
public function GetLoanRepaymentForm() : array |
|
139
|
|
|
{ |
|
140
|
|
|
/** |
|
141
|
|
|
* @var array<int, RepaymentSpecification> |
|
142
|
|
|
*/ |
|
143
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
144
|
5 |
|
'loanRepaymentForm', |
|
145
|
5 |
|
$this->RetrievePropertyValueFromData('loanRepaymentForm'), |
|
146
|
5 |
|
static::class |
|
147
|
|
|
); |
|
148
|
|
|
|
|
149
|
5 |
|
return $out; |
|
150
|
|
|
} |
|
151
|
|
|
|
|
152
|
|
|
/** |
|
153
|
|
|
* @param array<int, RepaymentSpecification> $value |
|
154
|
|
|
*/ |
|
155
|
1 |
|
public function SetLoanRepaymentForm(array $value) : void |
|
156
|
|
|
{ |
|
157
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
158
|
1 |
|
'loanRepaymentForm', |
|
159
|
1 |
|
__METHOD__, |
|
160
|
1 |
|
$value, |
|
161
|
1 |
|
RepaymentSpecification::class |
|
162
|
|
|
); |
|
163
|
1 |
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* @return array<int, QuantitativeValue> |
|
167
|
|
|
*/ |
|
168
|
5 |
|
public function GetLoanTerm() : array |
|
169
|
|
|
{ |
|
170
|
|
|
/** |
|
171
|
|
|
* @var array<int, QuantitativeValue> |
|
172
|
|
|
*/ |
|
173
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
174
|
5 |
|
'loanTerm', |
|
175
|
5 |
|
$this->RetrievePropertyValueFromData('loanTerm'), |
|
176
|
5 |
|
static::class |
|
177
|
|
|
); |
|
178
|
|
|
|
|
179
|
5 |
|
return $out; |
|
180
|
|
|
} |
|
181
|
|
|
|
|
182
|
|
|
/** |
|
183
|
|
|
* @param array<int, QuantitativeValue> $value |
|
184
|
|
|
*/ |
|
185
|
1 |
|
public function SetLoanTerm(array $value) : void |
|
186
|
|
|
{ |
|
187
|
1 |
|
$this->NudgePropertyWithUniqueValuesOfThings( |
|
188
|
1 |
|
'loanTerm', |
|
189
|
1 |
|
__METHOD__, |
|
190
|
1 |
|
$value, |
|
191
|
1 |
|
QuantitativeValue::class |
|
192
|
|
|
); |
|
193
|
1 |
|
} |
|
194
|
|
|
|
|
195
|
|
|
/** |
|
196
|
|
|
* @return array<int, string> |
|
197
|
|
|
*/ |
|
198
|
5 |
|
public function GetLoanType() : array |
|
199
|
|
|
{ |
|
200
|
|
|
/** |
|
201
|
|
|
* @var array<int, string> |
|
202
|
|
|
*/ |
|
203
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
204
|
5 |
|
'loanType', |
|
205
|
5 |
|
$this->RetrievePropertyValueFromData('loanType'), |
|
206
|
5 |
|
static::class |
|
207
|
|
|
); |
|
208
|
|
|
|
|
209
|
5 |
|
return $out; |
|
210
|
|
|
} |
|
211
|
|
|
|
|
212
|
|
|
/** |
|
213
|
|
|
* @param array<int, string> $value |
|
214
|
|
|
*/ |
|
215
|
1 |
|
public function SetLoanType(array $value) : void |
|
216
|
|
|
{ |
|
217
|
1 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
218
|
1 |
|
'loanType', |
|
219
|
1 |
|
__METHOD__, |
|
220
|
1 |
|
$value |
|
221
|
|
|
); |
|
222
|
1 |
|
} |
|
223
|
|
|
|
|
224
|
|
|
/** |
|
225
|
|
|
* @return array<int, bool> |
|
226
|
|
|
*/ |
|
227
|
5 |
|
public function GetRecourseLoan() : array |
|
228
|
|
|
{ |
|
229
|
|
|
/** |
|
230
|
|
|
* @var array<int, bool> |
|
231
|
|
|
*/ |
|
232
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
233
|
5 |
|
'recourseLoan', |
|
234
|
5 |
|
$this->RetrievePropertyValueFromData('recourseLoan'), |
|
235
|
5 |
|
static::class |
|
236
|
|
|
); |
|
237
|
|
|
|
|
238
|
5 |
|
return $out; |
|
239
|
|
|
} |
|
240
|
|
|
|
|
241
|
|
|
/** |
|
242
|
|
|
* @param array<int, bool> $value |
|
243
|
|
|
*/ |
|
244
|
1 |
|
public function SetRecourseLoan(array $value) : void |
|
245
|
|
|
{ |
|
246
|
1 |
|
$this->NudgePropertyWithUniqueBooleans( |
|
247
|
1 |
|
'recourseLoan', |
|
248
|
1 |
|
$value |
|
249
|
|
|
); |
|
250
|
1 |
|
} |
|
251
|
|
|
|
|
252
|
|
|
/** |
|
253
|
|
|
* @return array<int, bool> |
|
254
|
|
|
*/ |
|
255
|
5 |
|
public function GetRenegotiableLoan() : array |
|
256
|
|
|
{ |
|
257
|
|
|
/** |
|
258
|
|
|
* @var array<int, bool> |
|
259
|
|
|
*/ |
|
260
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
261
|
5 |
|
'renegotiableLoan', |
|
262
|
5 |
|
$this->RetrievePropertyValueFromData('renegotiableLoan'), |
|
263
|
5 |
|
static::class |
|
264
|
|
|
); |
|
265
|
|
|
|
|
266
|
5 |
|
return $out; |
|
267
|
|
|
} |
|
268
|
|
|
|
|
269
|
|
|
/** |
|
270
|
|
|
* @param array<int, bool> $value |
|
271
|
|
|
*/ |
|
272
|
1 |
|
public function SetRenegotiableLoan(array $value) : void |
|
273
|
|
|
{ |
|
274
|
1 |
|
$this->NudgePropertyWithUniqueBooleans( |
|
275
|
1 |
|
'renegotiableLoan', |
|
276
|
1 |
|
$value |
|
277
|
|
|
); |
|
278
|
1 |
|
} |
|
279
|
|
|
|
|
280
|
|
|
/** |
|
281
|
|
|
* @return array<int, string> |
|
282
|
|
|
*/ |
|
283
|
5 |
|
public function GetRequiredCollateral() : array |
|
284
|
|
|
{ |
|
285
|
|
|
/** |
|
286
|
|
|
* @var array<int, string> |
|
287
|
|
|
*/ |
|
288
|
5 |
|
$out = TypeUtilities::ExpectRetrievedValueIsArray( |
|
289
|
5 |
|
'requiredCollateral', |
|
290
|
5 |
|
$this->RetrievePropertyValueFromData('requiredCollateral'), |
|
291
|
5 |
|
static::class |
|
292
|
|
|
); |
|
293
|
|
|
|
|
294
|
5 |
|
return $out; |
|
295
|
|
|
} |
|
296
|
|
|
|
|
297
|
|
|
/** |
|
298
|
|
|
* @param array<int, string> $value |
|
299
|
|
|
*/ |
|
300
|
1 |
|
public function SetRequiredCollateral(array $value) : void |
|
301
|
|
|
{ |
|
302
|
1 |
|
$this->NudgePropertyWithUniqueTrimmedStringsMightNotBeString( |
|
303
|
1 |
|
'requiredCollateral', |
|
304
|
1 |
|
__METHOD__, |
|
305
|
1 |
|
$value |
|
306
|
|
|
); |
|
307
|
1 |
|
} |
|
308
|
|
|
} |
|
309
|
|
|
|