<?php

namespace App\Http\Requests\Frontend\Service;

use Illuminate\Foundation\Http\FormRequest;

final class ExchangeGoldRequest extends FormRequest
{
    public function authorize(): bool
    {
        return auth()->check();
    }

    /**
     * @return array<string, array<int, string>>
     */
    public function rules(): array
    {
        return [
            'gold_amount' => ['required', 'integer', 'min:1'],
        ];
    }

    public function getGoldAmount(): int
    {
        return (int) $this->validated('gold_amount');
    }
}
