<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class GeneratePayrollRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'month' => ['required', 'date_format:Y-m'],
            'employee_ids' => ['required', 'array', 'min:1'],
            'employee_ids.*' => ['required', 'exists:users,id'],
            'adjustments' => ['nullable', 'array'],
            'adjustments.*.employee_id' => ['required', 'exists:users,id'],
            'adjustments.*.addition' => ['nullable', 'numeric', 'min:0'],
            'adjustments.*.deduction' => ['nullable', 'numeric', 'min:0'],
        ];
    }
}
