<?php

namespace App\Http\Resources\Inventory;

use Illuminate\Http\Resources\Json\JsonResource;

class InventoryMovementResource extends JsonResource
{
    public function toArray($request): array
    {
        return [
            'id' => (int) ($this['id'] ?? 0),
            'item_id' => (int) ($this['item_id'] ?? 0),
            'item_name' => $this['item_name'] ?? null,
            'qty_change' => (int) ($this['qty_change'] ?? 0),
            'movement_type' => (string) ($this['movement_type'] ?? ''),
            'reason' => $this['reason'] ?? null,
            'note' => $this['note'] ?? null,
            'semester' => $this['semester'] ?? null,
            'school_year' => $this['school_year'] ?? null,
            'performed_by' => $this['performed_by'] ?? null,
            'performed_by_name' => $this['performed_by_name'] ?? null,
            'teacher_id' => $this['teacher_id'] ?? null,
            'teacher_name' => $this['teacher_name'] ?? null,
            'student_id' => $this['student_id'] ?? null,
            'student_name' => $this['student_name'] ?? null,
            'class_section_id' => $this['class_section_id'] ?? null,
            'class_section_name' => $this['class_section_name'] ?? null,
        ];
    }
}
