<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class AdminPasswordResetRequest extends FormRequest
{
    public function rules(): array
    {
        if (Auth::user()->has2FA()) {
            return [
                'currentPassword' => 'required|current_password:web',
                'otp' => 'required|integer|max:6',
            ];
        }

        return [
            'currentPassword' => 'required|current_password:web',
        ];
    }

    public function authorize(): bool
    {
        return true;
    }
}
