<?php

namespace App\Http\Requests\User\Account;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;
use Illuminate\Validation\Rules\Password;

class AddBankRequest extends FormRequest
{
    /**
     * Determine if the user is authorized to make this request.
     */
    public function authorize(): bool
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array<string, \Illuminate\Contracts\Validation\ValidationRule|array<mixed>|string>
     */
    public function rules()
    {
        return [
            'account_no' => ['required', 'digits_between:9,12', 'numeric'],
            'bank_id' => ['required', 'string', Rule::exists('banks', 'bank_id')],
        ];
    }

    public function messages()
    {
        return [
            'account_no.required' => 'Account number is required.',
            'account_no.digits_between' => 'Account number must be between 9 and 12 digits.',
            'account_no.numeric' => 'Account number must be a numeric value.',
            'bank_id.exists' => 'Bank with id does not exist.',
        ];
    }
}
