<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'party_id'     => 'required|exists:parties,id',
            'purchase_id'  => 'nullable|exists:purchases,id',
            'sale_id'      => 'nullable|exists:sales,id',
            'return_date'  => 'required|date',
            'reason'       => 'nullable|string|max:255',
            'subtotal'     => 'nullable|numeric|min:0',
            'deduction'    => 'nullable|numeric|min:0',
            'remarks'      => 'nullable|string|max:500',
        ];
    }
}
