<?php

declare(strict_types=1);

namespace App\Http\Requests\Groups;

use Illuminate\Foundation\Http\FormRequest;

class UpdateGroupAssetRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user() !== null;
    }

    public function rules(): array
    {
        return [
            'title' => ['required', 'string', 'min:2', 'max:180'],
            'description' => ['nullable', 'string', 'max:40000'],
            'category' => ['nullable', 'in:' . implode(',', (array) config('groups.assets.categories', []))],
            'visibility' => ['nullable', 'in:' . implode(',', (array) config('groups.assets.visibility_options', []))],
            'status' => ['nullable', 'in:' . implode(',', (array) config('groups.assets.statuses', []))],
            'linked_project_id' => ['nullable', 'integer'],
            'is_featured' => ['nullable', 'boolean'],
        ];
    }
}