<?php

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

class UpdateCustomReportRequest extends FormRequest
{
    public function authorize(): bool
    {
        // Policy check happens in controller via $this->authorize('update', $report);
        return $this->user('admin')?->can('view custom reports') ?? false;
    }

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:200'],
            'description' => ['nullable', 'string', 'max:2000'],
            'ir' => ['required', 'array'],
            'is_public' => ['nullable', 'boolean'],
        ];
    }
}
