<?php

namespace App\Http\Resources\Inventory;

use Illuminate\Http\Resources\Json\JsonResource;

class InventoryCategoryResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this['id'] ?? 0),
            'type' => (string) ($this['type'] ?? ''),
            'name' => (string) ($this['name'] ?? ''),
            'description' => $this['description'] ?? null,
            'grade_min' => $this['grade_min'] ?? null,
            'grade_max' => $this['grade_max'] ?? null,
        ];
    }
}
