2025-12-31 00:02:54 +01:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
namespace App\Http\Resources;
|
|
|
|
|
|
|
|
|
|
use Illuminate\Http\Request;
|
|
|
|
|
use Illuminate\Http\Resources\Json\JsonResource;
|
|
|
|
|
|
|
|
|
|
class BucketResource extends JsonResource
|
|
|
|
|
{
|
|
|
|
|
public function toArray(Request $request): array
|
|
|
|
|
{
|
|
|
|
|
return [
|
2026-03-19 21:01:56 +01:00
|
|
|
'id' => $this->uuid,
|
2025-12-31 00:02:54 +01:00
|
|
|
'name' => $this->name,
|
2026-03-19 21:14:36 +01:00
|
|
|
'type' => $this->type,
|
|
|
|
|
'type_label' => $this->type->getLabel(),
|
2025-12-31 00:02:54 +01:00
|
|
|
'priority' => $this->priority,
|
|
|
|
|
'sort_order' => $this->sort_order,
|
|
|
|
|
'allocation_type' => $this->allocation_type,
|
|
|
|
|
'allocation_value' => $this->allocation_value,
|
|
|
|
|
'allocation_type_label' => $this->getAllocationTypeLabel(),
|
2026-03-20 00:37:23 +01:00
|
|
|
'buffer_multiplier' => (float) $this->buffer_multiplier,
|
|
|
|
|
'effective_capacity' => $this->getEffectiveCapacity(),
|
2026-03-21 09:43:50 +01:00
|
|
|
'starting_amount' => $this->starting_amount,
|
2025-12-31 00:02:54 +01:00
|
|
|
'current_balance' => $this->getCurrentBalance(),
|
|
|
|
|
'has_available_space' => $this->hasAvailableSpace(),
|
|
|
|
|
'available_space' => $this->getAvailableSpace(),
|
|
|
|
|
];
|
|
|
|
|
}
|
|
|
|
|
}
|