Files
Toiminnanohjaus/app/Modules/Jobs/Application/DTOs/BookableTask.php
T
2026-11-30 06:56:14 +02:00

46 lines
1.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php
declare(strict_types=1);
namespace App\Modules\Jobs\Application\DTOs;
use App\Modules\Jobs\Domain\Enums\JobStatus;
use App\Modules\Jobs\Domain\Enums\TaskStatus;
/**
* A task as time is recorded on it: which job, customer and work type it
* belongs to, the job's payment basis (a PaymentBasis value) and whether
* the job is locked for time entries.
*/
final readonly class BookableTask
{
public function __construct(
public int $taskId,
public int $jobId,
public string $jobNumber,
public string $jobName,
public string $taskTitle,
public int $workTypeId,
public string $workTypeName,
public JobStatus $jobStatus,
public TaskStatus $taskStatus,
public int $customerId = 0,
public string $customerName = '',
public ?string $customerHeaderColor = null,
public ?string $paymentBasis = null,
) {}
public function isLocked(): bool
{
return $this->jobStatus->locksTime();
}
/**
* E.g. "2026-0005 Messuvideo – Mainoskuvat".
*/
public function label(): string
{
return $this->jobNumber.' '.$this->jobName.' – '.$this->taskTitle;
}
}