<?php
namespace App\V4\Model\Address;
use ApiPlatform\Core\Annotation\ApiProperty;
use App\Model\IriNormalizableInterface;
use App\Model\NormalizeAsIRITrait;
use App\Model\Traits\ImportableObjectTrait;
use App\V4\Model\Contact\Contact;
use Symfony\Component\Serializer\Annotation\Groups;
class Address implements IriNormalizableInterface
{
use ImportableObjectTrait;
use NormalizeAsIRITrait;
const TYPE_DELIVERY_ADDRESS = 'deliveryAddress';
/**
* @ApiProperty(identifier=true)
*
* @var string
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $id;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $address;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $addressMore;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $postalCode;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $postalCedex;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $city;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $country;
/**
* @var float|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $lat;
/**
* @var float|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $lng;
/**
* @var bool|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $isGeolocated;
/**
* @var bool
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $isMain;
/**
* @var string|null
*
* @Groups({
* "prospect:list", "prospect:read", "prospect:write", "prospect:update",
* "contact:list", "contact:read", "contact:write", "contact:update"
* })
*/
private $typeAddress;
/**
* @var Contact|null
*/
private $contact;
/**
* @return string
*/
public function getAddressAndAddressMore(): string
{
if (!empty($this->getAddress())) {
return $this->getAddress().(!empty($this->getAddressMore()) ? ', '.$this->getAddressMore() : '');
}
return !empty($this->getAddressMore()) ? $this->getAddressMore() : '';
}
/**
* @return string
*/
public function getId(): ?string
{
return $this->id;
}
/**
* @param string $id
*
* @return Address
*/
public function setId(string $id): Address
{
$this->id = $id;
return $this;
}
/**
* @return string|null
*/
public function getAddress(): ?string
{
return $this->address;
}
/**
* @param string|null $address
*
* @return Address
*/
public function setAddress(?string $address): Address
{
$this->address = $address;
return $this;
}
/**
* @return string|null
*/
public function getAddressMore(): ?string
{
return $this->addressMore;
}
/**
* @param string|null $addressMore
*
* @return $this
*/
public function setAddressMore(?string $addressMore): self
{
$this->addressMore = $addressMore;
return $this;
}
/**
* @return string|null
*/
public function getPostalCode(): ?string
{
return $this->postalCode;
}
/**
* @param string|null $postalCode
*
* @return $this
*/
public function setPostalCode(?string $postalCode): self
{
$this->postalCode = trim(str_replace(' ', '', $postalCode));
return $this;
}
/**
* @return string|null
*/
public function getPostalCedex(): ?string
{
return $this->postalCedex;
}
/**
* @param string|null $postalCedex
*
* @return $this
*/
public function setPostalCedex(?string $postalCedex): self
{
$this->postalCedex = $postalCedex;
return $this;
}
/**
* @return string|null
*/
public function getCity(): ?string
{
return $this->city;
}
/**
* @param string|null $city
*
* @return $this
*/
public function setCity(?string $city): self
{
$this->city = $city;
return $this;
}
/**
* @return string|null
*/
public function getCountry(): ?string
{
return $this->country;
}
/**
* @param string|null $country
*
* @return $this
*/
public function setCountry(?string $country): self
{
$this->country = $country;
return $this;
}
/**
* @return float|null
*/
public function getLat(): ?float
{
return $this->lat;
}
/**
* @param float|null $lat
*
* @return $this
*/
public function setLat(?float $lat): self
{
$this->lat = $lat;
return $this;
}
/**
* @return float|null
*/
public function getLng(): ?float
{
return $this->lng;
}
/**
* @param float|null $lng
*
* @return $this
*/
public function setLng(?float $lng): self
{
$this->lng = $lng;
return $this;
}
/**
* @return bool|null
*/
public function getisGeolocated(): ?bool
{
return $this->isGeolocated;
}
/**
* @param bool|null $isGeolocated
*
* @return $this
*/
public function setIsGeolocated(?bool $isGeolocated): self
{
$this->isGeolocated = $isGeolocated;
return $this;
}
/**
* @return bool|null
*/
public function isMain(): ?bool
{
return $this->isMain;
}
/**
* @param bool|null $isMain
*
* @return $this
*/
public function setIsMain(?bool $isMain): self
{
$this->isMain = $isMain;
return $this;
}
/**
* @return Contact|null
*/
public function getContact(): ?Contact
{
return $this->contact;
}
/**
* @param Contact|null $contact
*
* @return Address
*/
public function setContact(?Contact $contact): Address
{
$this->contact = $contact;
return $this;
}
/**
* @return string|null
*/
public function getTypeAddress(): ?string
{
return $this->typeAddress;
}
/**
* @param string|null $typeAddress
*
* @return Address
*/
public function setTypeAddress(?string $typeAddress): Address
{
$this->typeAddress = $typeAddress;
return $this;
}
/**
* {@inheritdoc}
*/
public function __toString()
{
return $this->getAddress().' - '.$this->getCity().' - '.$this->getPostalCode();
}
}