<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        $providers = implode(',', array_keys(config('feed.providers', [])));

        return [
            'name' => 'required|string|max:255',
            'provider' => "required|in:{$providers}",
            'language_id' => 'required|exists:languages,id',
            'description' => 'nullable|string',
            'is_active' => 'boolean',
        ];
    }
}
