<?php

declare(strict_types=1);

namespace App\Http\Requests\Admin;

use Illuminate\Foundation\Http\FormRequest;

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

    /** @return array<string, array<int, mixed>> */
    public function rules(): array
    {
        return [
            'new_expiry_date' => ['required', 'date', 'after:today'],
            'reason' => ['nullable', 'string', 'max:500'],
        ];
    }

    /** @return array<string, string> */
    public function messages(): array
    {
        return [
            'new_expiry_date.required' => 'A new expiry date is required.',
            'new_expiry_date.date' => 'Please provide a valid date.',
            'new_expiry_date.after' => 'The new expiry date must be in the future.',
            'reason.max' => 'The reason cannot exceed 500 characters.',
        ];
    }
}
