uuid = Uuid::v4()->toRfc4122(); $this->session = $session; $this->serviceItem = $serviceItem; $this->staff = $staff; $this->priceRials = $serviceItem->getPriceRials(); $this->quantity = max(1, $quantity); $this->createdAt = time(); } public function getId(): ?int { return $this->id; } public function getUuid(): string { return $this->uuid; } public function getSession(): PatientSession { return $this->session; } public function getServiceItem(): ServiceItem { return $this->serviceItem; } public function getStaff(): ?ClinicStaff { return $this->staff; } public function getPriceRials(): int { return $this->priceRials; } public function getQuantity(): int { return $this->quantity; } public function getLineTotalRials(): int { return $this->priceRials * $this->quantity; } public function getCreatedAt(): int { return $this->createdAt; } public function toArray(): array { return [ 'uuid' => $this->uuid, 'service_item_uuid' => $this->serviceItem->getUuid(), 'service_name' => $this->serviceItem->getName(), 'staff_uuid' => $this->staff?->getUuid(), 'staff_name' => $this->staff?->getFullName(), 'price_rials' => $this->priceRials, 'quantity' => $this->quantity, 'line_total_rials' => $this->getLineTotalRials(), 'created_at' => $this->createdAt, ]; } }