<?php

namespace App\Modules\Integrations\Platform\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

    /**
     * @return array<string, mixed>
     */
    public function rules(): array
    {
        return [
            'name' => ['sometimes', 'string', 'max:120'],
            'url' => ['sometimes', 'string', 'url', 'max:500'],
            'topics' => ['sometimes', 'array', 'min:1'],
            'topics.*' => ['required', 'string', 'regex:/^[a-z0-9._]+\\.v[0-9]+$/i'],
        ];
    }
}
