<?php

declare(strict_types=1);

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

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('winback_campaigns', function (Blueprint $table): void {
            $table->id();
            $table->string('name', 255);
            $table->string('cancellation_reason', 100)->nullable();
            $table->json('email_sequence');
            $table->enum('offer_type', ['discount', 'credit', 'free_upgrade', 'none']);
            $table->decimal('offer_value', 10, 2)->nullable();
            $table->unsignedInteger('offer_duration_days')->nullable();
            $table->string('coupon_code', 50)->nullable();
            $table->enum('status', ['active', 'paused', 'archived'])->default('active');
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('winback_campaigns');
    }
};
