<?php

namespace App\Resources;

use Wibiesana\Padi\Core\Resource;

class AttendanceDailyStaffResource extends Resource
{
    public function toArray($request): array
    {
        return [
            'id' => $this->id,
            'staff_id' => $this->staff_id,
            'attendance_date' => $this->attendance_date,
            'status' => $this->status,
            'check_in_time' => $this->check_in_time,
            'check_out_time' => $this->check_out_time,
            'note' => $this->note,

            // Relations
            'staff' => $this->whenLoaded('staff'),

            // Flattened Fields
            'staff_name' => $this->staff['name'] ?? null,

        ];
    }
}