<?php
declare(strict_types=1);
namespace App\Order\Doctrine\Entity;
use Doctrine\DBAL\Types\Types;
use Doctrine\ORM\Mapping\Column;
use Doctrine\ORM\Mapping\Embeddable;
use Symfony\Component\Serializer\Annotation\Groups;
use Symfony\Component\Validator\Constraints\Email;
use Symfony\Component\Validator\Constraints\NotBlank;
#[Embeddable]
class Address
{
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner une adresse.')]
private string $address;
#[Groups(['read', 'write'])]
#[Column(type: Types::TEXT, nullable: true)]
private ?string $restAddress = null;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner un code postal.')]
private string $zipCode;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner une ville.')]
private string $city;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner un pays.')]
private string $country;
#[Groups(['read', 'write'])]
#[Column(type: Types::BOOLEAN)]
private bool $professional = true;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING, nullable: true)]
private ?string $companyName = null;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner un prénom.')]
private string $firstName;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner un nom.')]
private string $lastName;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner un numéro de téléphone.')]
private string $phone;
#[Groups(['read', 'write'])]
#[Column(type: Types::STRING)]
#[NotBlank(message: 'Veuillez renseigner une adresse email.')]
#[Email]
private string $email;
/**
* @var array<array-key, string>
*/
#[Column(type: Types::JSON, options: ['collation' => 'utf8mb4_bin'])]
#[Groups(['read', 'write'])]
private array $copyEmails = [];
/**
* @var array<array-key, string>
*/
#[Column(type: Types::JSON, options: ['collation' => 'utf8mb4_bin'])]
#[Groups(['read', 'write'])]
private array $blindCopyEmails = [];
public function getAddress(): string
{
return $this->address;
}
public function setAddress(string $address): void
{
$this->address = $address;
}
public function getRestAddress(): ?string
{
return $this->restAddress;
}
public function setRestAddress(?string $restAddress): void
{
$this->restAddress = $restAddress;
}
public function getZipCode(): string
{
return $this->zipCode;
}
public function setZipCode(string $zipCode): void
{
$this->zipCode = $zipCode;
}
public function getCity(): string
{
return $this->city;
}
public function setCity(string $city): void
{
$this->city = $city;
}
public function getCountry(): string
{
return $this->country;
}
public function setCountry(string $country): void
{
$this->country = $country;
}
public function getFirstName(): string
{
return $this->firstName;
}
public function setFirstName(string $firstName): void
{
$this->firstName = $firstName;
}
public function getLastName(): string
{
return $this->lastName;
}
public function setLastName(string $lastName): void
{
$this->lastName = $lastName;
}
public function getPhone(): string
{
return $this->phone;
}
public function setPhone(string $phone): void
{
$this->phone = $phone;
}
public function getEmail(): string
{
return $this->email;
}
public function setEmail(string $email): void
{
$this->email = $email;
}
public function getCopyEmails(): array
{
return $this->copyEmails;
}
public function setCopyEmails(array $copyEmails): void
{
$this->copyEmails = $copyEmails;
}
public function getBlindCopyEmails(): array
{
return $this->blindCopyEmails;
}
public function setBlindCopyEmails(array $blindCopyEmails): void
{
$this->blindCopyEmails = $blindCopyEmails;
}
public function isProfessional(): bool
{
return $this->professional;
}
public function setProfessional(bool $professional): void
{
$this->professional = $professional;
}
public function getCompanyName(): ?string
{
return $this->companyName;
}
public function setCompanyName(?string $companyName): void
{
$this->companyName = $companyName;
}
public function getFullName(): string
{
return $this->firstName . ' ' . $this->lastName;
}
}