Files
Toiminnanohjaus/app/Modules/TimeTracking/Domain/Enums/EntryBillingModel.php
T
2026-11-30 06:56:14 +02:00

48 lines
1.2 KiB
PHP

<?php
declare(strict_types=1);
namespace App\Modules\TimeTracking\Domain\Enums;
/**
* Laskutusperuste of a time entry (docs/ui-timesheet.md 5.2): within a
* fixed price (K), billed by the hour (€) or not billable (•). It is
* tracking only: billing still follows the job's payment basis.
*/
enum EntryBillingModel: string
{
case Fixed = 'fixed';
case Hourly = 'hourly';
case NonBillable = 'non_billable';
/**
* The default of an entry, from its job's payment basis (a Jobs
* PaymentBasis value).
*/
public static function forPaymentBasis(?string $paymentBasis): self
{
return match ($paymentBasis) {
'fixed_quote', 'price_list', 'monthly_fee' => self::Fixed,
'not_billable' => self::NonBillable,
default => self::Hourly,
};
}
public function symbol(): string
{
return match ($this) {
self::Fixed => 'K',
self::Hourly => '€',
self::NonBillable => '•',
};
}
/**
* Billed or within a fixed price, against internal work.
*/
public function isBillable(): bool
{
return $this !== self::NonBillable;
}
}