<?php

namespace Modules\Payroll\Transformers;

use Illuminate\Http\Request;
use Illuminate\Http\Resources\Json\JsonResource;

class PayrollCycleResource extends JsonResource
{
    public function toArray(Request $request): array
    {
        return [
            'id' => $this->id,
            'name' => $this->name,

            'month' => $this->month,
            'year' => $this->year,

            'from_date' => $this->from_date,
            'to_date' => $this->to_date,
            'salary_date' => $this->salary_date,

            'status' => $this->status,

            // summary
            'total_employees' => $this->total_employees,
            'total_net_salary' =>  $this->total_net_salary,

            'remarks' => $this->remarks,

            // approval info
            'approved_by' => $this->approved_by,
            'approved_at' => $this->approved_at,

            // payment info
            'paid_by' => $this->paid_by,
            'paid_at' => $this->paid_at,

            // lock info
            'is_locked' => $this->is_locked,
            'locked_by' => $this->locked_by,
            'locked_at' => $this->locked_at,

            'created_at' => $this->created_at,
            'updated_at' => $this->updated_at,
        ];
    }
}
