<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Support\Facades\Auth;

class PageBulkUpdateIdsRequest extends FormRequest
{
    public function authorize(): bool
    {
        return Auth::check();
    }

    public function rules(): array
    {
        return [
            'page_ids' => ['required', 'array', 'max:100'],
            'page_ids.*' => ['required', 'integer', 'exists:pages,id'],
        ];
    }

    public function messages(): array
    {
        return [
            'page_ids.required' => 'Please select at least one page.',
            'page_ids.max' => 'You can only update up to 100 pages at a time.',
            'page_ids.*.exists' => 'One or more selected pages do not exist.',
        ];
    }
}
