<?php

namespace App\Http\Requests;

use Illuminate\Foundation\Http\FormRequest;

class UpdateSmsGatewayRequest extends FormRequest
{
    public function authorize(): bool
    {
        return $this->user()->can('sms.update');
    }

    public function rules(): array
    {
        return [
            'name' => ['required', 'string', 'max:255'],
            'provider' => ['required', 'in:bulksmsbd,greenweb,sslwireless,muthofun,boomcast,generic'],
            'api_url' => ['nullable', 'url', 'max:1024'],
            'api_key' => ['nullable', 'string', 'max:1024'],
            'sender_id' => ['nullable', 'string', 'max:50'],
            'settings' => ['nullable', 'json'],
            'status' => ['required', 'boolean'],
        ];
    }
}
