uuid = Uuid::v4()->toRfc4122(); $this->entityType = $entityType; $this->entityId = $entityId; $this->fullName = $fullName; $this->createdAt = time(); $this->updatedAt = time(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getEntityType(): string { return $this->entityType; } public function getEntityId(): int { return $this->entityId; } public function getFullName(): string { return $this->fullName; } public function getPhone(): ?string { return $this->phone; } public function getJobTitle(): ?string { return $this->jobTitle; } public function getAddress(): ?string { return $this->address; } public function getNationalCode(): ?string { return $this->nationalCode; } public function isActive(): bool { return $this->active; } public function getUser(): ?User { return $this->user; } public function hasAccount(): bool { return $this->user !== null; } public function getCreatedAt(): int { return $this->createdAt; } public function getUpdatedAt(): int { return $this->updatedAt; } public function setFullName(string $fullName): self { $this->fullName = $fullName; $this->updatedAt = time(); return $this; } public function setPhone(?string $phone): self { $this->phone = $phone; $this->updatedAt = time(); return $this; } public function setJobTitle(?string $jobTitle): self { $this->jobTitle = $jobTitle; $this->updatedAt = time(); return $this; } public function setAddress(?string $address): self { $this->address = $address; $this->updatedAt = time(); return $this; } public function setNationalCode(?string $code): self { $this->nationalCode = $code; $this->updatedAt = time(); return $this; } public function setActive(bool $active): self { $this->active = $active; $this->updatedAt = time(); return $this; } public function setUser(?User $user): self { $this->user = $user; $this->updatedAt = time(); return $this; } public function toggleActive(): self { $this->active = !$this->active; $this->updatedAt = time(); return $this; } public function toArray(): array { return [ 'uuid' => $this->uuid, 'entity_type' => $this->entityType, 'entity_id' => $this->entityId, 'full_name' => $this->fullName, 'phone' => $this->phone, 'job_title' => $this->jobTitle, 'address' => $this->address, 'national_code' => $this->nationalCode, 'active' => $this->active, 'has_account' => $this->user !== null, 'user_uuid' => $this->user?->getUuid(), 'created_at' => $this->createdAt, 'updated_at' => $this->updatedAt, ]; } }