<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class TestSendSmsRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()?->can('manage-settings') ?? false;
    }

    public function rules(): array
    {
        return [
            'to' => ['required', 'string', 'max:30'], // E.164-ish; we can refine later
            'message' => ['required', 'string', 'max:1000'],
            'sender_id' => ['nullable', 'integer', 'exists:sms_senders,id'],
            'delivery_report' => ['sometimes', 'boolean'],
            'country_code' => ['nullable', 'string', 'max:5'],
        ];
    }
}
