2026-03-19 21:14:36 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Enums;
|
|
|
|
|
|
|
|
|
|
enum BucketTypeEnum: string
|
|
|
|
|
{
|
|
|
|
|
case NEED = 'need';
|
|
|
|
|
case WANT = 'want';
|
|
|
|
|
case OVERFLOW = 'overflow';
|
|
|
|
|
|
|
|
|
|
public function getLabel(): string
|
|
|
|
|
{
|
|
|
|
|
return match ($this) {
|
|
|
|
|
self::NEED => 'Need',
|
|
|
|
|
self::WANT => 'Want',
|
|
|
|
|
self::OVERFLOW => 'Overflow',
|
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function values(): array
|
|
|
|
|
{
|
|
|
|
|
return array_column(self::cases(), 'value');
|
|
|
|
|
}
|
2026-03-19 23:54:58 +01:00
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* Get valid allocation types for this bucket type.
|
|
|
|
|
*
|
|
|
|
|
* @return BucketAllocationTypeEnum[]
|
|
|
|
|
*/
|
|
|
|
|
public function getAllowedAllocationTypes(): array
|
|
|
|
|
{
|
|
|
|
|
return match ($this) {
|
|
|
|
|
self::NEED, self::WANT => [BucketAllocationTypeEnum::FIXED_LIMIT, BucketAllocationTypeEnum::PERCENTAGE],
|
|
|
|
|
self::OVERFLOW => [BucketAllocationTypeEnum::UNLIMITED],
|
|
|
|
|
};
|
|
|
|
|
}
|
2026-03-19 21:14:36 +01:00
|
|
|
}
|