<?php
namespace App\DTO\LicenciasOnline;
final class CreateEndCustomerRequestDTO
{
private ?int $id; // debe ir null para "nuevo"
private ?string $fictitiousName;
private string $name;
private ?string $taxId;
private ?string $phoneNumber;
private ?string $grossIncome;
private string $type;
private int $countryId;
private ?int $addressId; // null para nueva address
private string $street;
private int $provincePvsId;
private string $addressPhoneNumber;
private string $city;
private string $postalCode;
public function __construct(
?int $id = null,
?string $fictitiousName,
string $name,
?string $taxId,
?string $phoneNumber,
int $countryId,
?string $grossIncome = null,
array $address = []
) {
$this->id = $id;
$this->fictitiousName = $fictitiousName;
$this->name = $name;
$this->taxId = $taxId;
$this->phoneNumber = $phoneNumber;
$this->grossIncome = $grossIncome;
$this->countryId = $countryId;
$this->address = $address;
$this->addressId = null;
$this->type = 'EndCustomer';
$this->provincePvsId = 1;
}
public function toArray(): array
{
return [
'id' => $this->id,
'fictitiousName' => $this->fictitiousName,
'name' => $this->name,
'taxId' => $this->taxId,
'phoneNumber' => $this->phoneNumber,
'grossIncome' => $this->grossIncome,
'Type' => $this->type,
'countryId' => $this->countryId,
'address' => [
'id' => $this->addressId,
'street' => $this->address['street'],
'phoneNumber' => $this->address['phoneNumber'],
'city' => $this->address['city'],
'PostalCode' => $this->address['postalCode'],
'Province' => [
'pvsId' => $this->address['provincePvsId'],
],
],
];
}
}