<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'enabled' => ['nullable', 'array'],
            'enabled.*' => ['integer', 'exists:payment_methods,id'],
            'methods' => ['required', 'array'],
            'methods.*.id' => ['required', 'integer', 'exists:payment_methods,id'],
            'methods.*.account_label' => ['nullable', 'string', 'max:120'],
            'methods.*.account_value' => ['nullable', 'string', 'max:255'],
            'methods.*.instructions' => ['nullable', 'string', 'max:5000'],
        ];
    }
}
