<?php

namespace App\Http\Requests\Order;

use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'payments' => ['required', 'array', 'min:1'],
            'payments.*.payment_method_id' => ['required', 'integer', 'exists:payment_methods,id'],
            'payments.*.amount' => ['required', 'numeric', 'gt:0'],
            'payments.*.currency_code' => ['nullable', 'string', 'size:3'],
            'payments.*.exchange_rate' => ['nullable', 'numeric', 'min:0.000001'],
            'payments.*.reference_number' => ['nullable', 'string', 'max:191'],
            'payments.*.notes' => ['nullable', 'string', 'max:500'],
            'payments.*.status' => ['nullable', 'string'],
        ];
    }
}
