<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

/**
 * API 表单校验基类：字段中文名等从 lang/validation.php 的 attributes 读取。
 */
abstract class ApiFormRequest extends FormRequest
{
    /**
     * @return array<string, string>
     */
    public function attributes(): array
    {
        $locale = $this->attributes->get('lottery_locale')
            ?? config('lottery.locales.fallback', 'en');

        $labels = trans('validation.attributes', [], (string) $locale);

        return is_array($labels) ? $labels : [];
    }
}
