Attainly/backend/app/Schedule/ScheduleAssignment.php

71 lines
1.3 KiB
PHP

<?php
namespace App\Schedule;
use DateTimeImmutable;
final class ScheduleAssignment
{
/**
* @param list<string> $path
*/
public function __construct(
private int $id,
private string $name,
private string $kind,
private array $path,
private DateTimeImmutable $scheduledDate,
private int $position,
private ?DateTimeImmutable $completedAt,
) {}
public function getId(): int
{
return $this->id;
}
public function getName(): string
{
return $this->name;
}
public function getKind(): string
{
return $this->kind;
}
/**
* @return list<string>
*/
public function getPath(): array
{
return $this->path;
}
public function getScheduledDate(): DateTimeImmutable
{
return $this->scheduledDate;
}
public function getPosition(): int
{
return $this->position;
}
public function getCompletedAt(): ?DateTimeImmutable
{
return $this->completedAt;
}
public function complete(DateTimeImmutable $completedAt): void
{
if ($this->completedAt === null) {
$this->completedAt = $completedAt;
}
}
public function reopen(): void
{
$this->completedAt = null;
}
}