<?php

namespace App\Modules\Integrations\Platform\Requests;

use Illuminate\Foundation\Http\FormRequest;

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

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