<?php

namespace App\Http\Requests\Leasing;

use Illuminate\Foundation\Http\FormRequest;

class StoreLeasingRecordRequest extends FormRequest
{
    public function authorize(): bool
    {
        return true; // Handled by Policy at controller level
    }

    public function rules(): array
    {
        return [
            'branch_id' => 'nullable|exists:branches,id',
            'tgl_data' => 'required|date',
            'nopol' => 'required|string|max:20',
            'rangka' => 'required|string|max:50',
            'mesin' => 'required|string|max:50',
            'model' => 'nullable|string|max:100',
            'kendaraan' => 'nullable|string|max:100',
            'customer_name' => 'nullable|string|max:100',
            'customer_phone' => 'nullable|string|max:20',
            'customer_address' => 'nullable|string',
            'overdue_days' => 'nullable|integer|min:0',
            'sisa_saldo' => 'nullable|numeric|min:0',
            'legal_flag' => 'boolean',
            'member_warning' => 'nullable|string',
            'member_instruction' => 'nullable|string',
            'internal_note' => 'nullable|string',
        ];
    }
}
