<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::create('webhook_mappings', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('prefix')->unique();
            $table->enum('provider', ['singapay', 'faspay', '*'])->default('*');
            $table->string('forward_url');
            $table->enum('auth_type', ['hmac', 'api_key', 'none'])->default('hmac');
            $table->text('secret')->nullable();
            $table->boolean('is_active')->default(true);
            $table->unsignedSmallInteger('timeout_seconds')->default(10);
            $table->unsignedTinyInteger('max_retries')->default(5);
            $table->text('notes')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('webhook_mappings');
    }
};
