<?php

namespace App\Http\Requests\Account;

use App\Services\AccountService;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

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

    public function rules(): array
    {
        return [
            'password' => ['required', 'string'],
            'reason' => ['nullable', 'string', Rule::in(array_keys(AccountService::getWithdrawalReasons()))],
            'detail' => ['nullable', 'string', 'max:500'],
        ];
    }

    public function messages(): array
    {
        return [
            'password.required' => __('validation.required', ['attribute' => '비밀번호']),
            'reason.in' => __('validation.in', ['attribute' => '탈퇴 사유']),
        ];
    }
}
