<?php

namespace App\Http\Requests\Admin\Championship;

use App\Enums\ChampionshipStatusEnum;
use Illuminate\Foundation\Http\FormRequest;

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

    public function rules(): array
    {
        return [
            'name.en' => ['required', 'string', 'max:255'],
            'name.ar' => ['nullable', 'string', 'max:255'],
            'image' => ['nullable', 'image', 'max:2048'],
            'price' => ['required', 'numeric', 'min:0'],
            'game_id' => ['required', 'exists:games,id'],
            'players_count' => ['required', 'integer', 'min:1'],
            'status' => ['required', 'integer', 'in:' . implode(',', ChampionshipStatusEnum::values())],
        ];
    }
}
