<?phpnamespace Whater\Domain\Whater\Model;use Ramsey\Uuid\Uuid;use Whater\Domain\Common\Exception\InvalidUUIDException;/** * Class WhaterOrganizationCode * * @package Whater\Domain\Whater\Model */class WhaterOrganizationCode{ const EXTERNAL_SYSTEM_SINAC = "ES_SINAC"; /** * @var string */ private $uuid; /** * @var string */ private $code; /** * @var string */ private $externalSystem; /** * @var WhaterOrganization */ private $whaterOrganization; /** * @var \DateTime */ private $createdAt; /** * @param string $whaterOrganizationCodeId * @param string $name * @param string $details * @param string $slug * @param string $urlWeb */ public function __construct( string $whaterOrganizationCodeId = null, WhaterOrganization $whaterOrganization, string $code, string $externalSystem = WhaterOrganizationCode::EXTERNAL_SYSTEM_SINAC ) { try { $this->uuid = Uuid::fromString($whaterOrganizationCodeId ?: Uuid::uuid4())->toString(); } catch (\InvalidArgumentException $e) { throw new InvalidUUIDException(); } $this->whaterOrganization = $whaterOrganization; $this->code = $code; $this->externalSystem = $externalSystem; $this->createdAt = new \DateTime(); } /** * @return string */ public function id(): string { return $this->uuid; } /** * @return WhaterOrganization */ public function whaterOrganization(): WhaterOrganization { return $this->whaterOrganization; } /** * @return string */ public function code(): string { return $this->code; } /** * @return string */ public function externalSystem(): string { return $this->externalSystem; } /** * @return \DateTime */ public function createdAt(): \DateTime { return $this->createdAt; }}