id = Uuid::v4(); $this->createdAt = new \DateTimeImmutable(); $this->status = self::STATUS_QUEUED; } public function getId(): Uuid { return $this->id; } public function getStatus(): string { return $this->status; } public function markRunning(): void { $this->status = self::STATUS_RUNNING; $this->startedAt = new \DateTimeImmutable(); $this->errorMessage = null; } public function markCompleted(): void { $this->status = self::STATUS_COMPLETED; $this->finishedAt = new \DateTimeImmutable(); } public function markFailed(string $message): void { $this->status = self::STATUS_FAILED; $this->finishedAt = new \DateTimeImmutable(); $this->errorMessage = $message; } public function getCreatedAt(): \DateTimeImmutable { return $this->createdAt; } public function getStartedAt(): ?\DateTimeImmutable { return $this->startedAt; } public function getFinishedAt(): ?\DateTimeImmutable { return $this->finishedAt; } public function getErrorMessage(): ?string { return $this->errorMessage; } }