| 1 |
<?php |
| 2 |
|
| 3 |
namespace App\Billingo\Validation\Partner; |
| 4 |
|
| 5 |
use App\Billingo\Enums\Partner\ShowTypeEnum; |
| 6 |
use App\Billingo\Enums\Partner\TaxTypeEnum; |
| 7 |
use App\Billingo\Models\Address; |
| 8 |
use App\Billingo\Models\Partner\PartnerCustomBillingoSettings; |
| 9 |
use App\Billingo\Models\Partner\PartnerGiroSettings; |
| 10 |
use App\Billingo\Models\Partner\PartnerShipping; |
| 11 |
use App\Billingo\Validation\Validator; |
| 12 |
|
| 13 |
class PartnerValidator extends Validator |
| 14 |
{ |
| 15 |
|
| 16 |
protected function rules(): array |
| 17 |
{ |
| 18 |
return [ |
| 19 |
'id' => ['optional', 'integer'], |
| 20 |
'name' => ['required', 'string'], |
| 21 |
'address' => ['required', ['instanceOf', Address::class]], |
| 22 |
'emails' => ['optional', 'array'], |
| 23 |
'emails.*' => ['email'], |
| 24 |
'taxcode' => ['optional', 'string'], |
| 25 |
'iban' => ['optional', 'string'], |
| 26 |
'swift' => ['optional', 'string'], |
| 27 |
'account_number' => ['optional', 'string'], |
| 28 |
'phone' => ['optional', 'string'], |
| 29 |
'general_ledger_number' => ['optional', 'string'], |
| 30 |
'tax_type' => ['optional', ['in', getEnumValues(TaxTypeEnum::class)]], |
| 31 |
'custom_billing_settings' => ['optional', ['instanceOf', PartnerCustomBillingoSettings::class]], |
| 32 |
'group_member_tax_number' => ['optional', 'string'], |
| 33 |
'giro_settings' => ['optional', 'nullable', ['instanceOf', PartnerGiroSettings::class]], |
| 34 |
'partner_shipping' => ['optional', 'nullable', ['instanceOf', PartnerShipping::class]], |
| 35 |
'internal_comment' => ['optional', 'string'], |
| 36 |
'partner_show_type' => ['optional', 'nullable', ['in', getEnumValues(ShowTypeEnum::class)]], |
| 37 |
]; |
| 38 |
} |
| 39 |
} |
| 40 |
|