<?php

namespace App\Http\Requests;

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

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

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

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