<?php

namespace App\Http\Requests;

use App\Enums\PaymentMethodType;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'type' => ['required', Rule::enum(PaymentMethodType::class)],
            'instructions' => ['required', 'string'],
            'details' => ['nullable', 'array'],
            'detail_keys' => ['nullable', 'array'],
            'detail_keys.*' => ['nullable', 'string', 'max:255'],
            'detail_values' => ['nullable', 'array'],
            'detail_values.*' => ['nullable', 'string', 'max:1000'],
            'is_active' => ['nullable', 'boolean'],
        ];
    }
}
