<?php

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

return new class extends Migration
{
    /**
     * PRC-785: İptal nedeni opsiyonel olabildiği için `reason` enum'ı
     * nullable yapılır (ayar kapalıyken müşteri neden seçmeden iptal eder).
     */
    public function up(): void
    {
        Schema::table('cancellation_requests', function (Blueprint $table) {
            $table->enum('reason', [
                'not_satisfied',
                'too_expensive',
                'found_better_alternative',
                'no_longer_needed',
                'technical_issues',
                'poor_support',
                'moved_to_competitor',
                'business_closed',
                'other',
            ])->nullable()->comment('İptal nedeni (opsiyonel olabilir, PRC-785)')->change();
        });
    }

    public function down(): void
    {
        Schema::table('cancellation_requests', function (Blueprint $table) {
            $table->enum('reason', [
                'not_satisfied',
                'too_expensive',
                'found_better_alternative',
                'no_longer_needed',
                'technical_issues',
                'poor_support',
                'moved_to_competitor',
                'business_closed',
                'other',
            ])->nullable(false)->comment('İptal nedeni')->change();
        });
    }
};
