<?php

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::table('survey_responses', function (Blueprint $table) {
            $table->text('ai_strategic_diagnosis')->nullable()->after('recommended_tier');
            $table->text('ai_customer_narrative')->nullable()->after('ai_strategic_diagnosis');
            $table->json('ai_action_plan_30day')->nullable()->after('ai_customer_narrative');
            $table->json('ai_content_ideas')->nullable()->after('ai_action_plan_30day');
            $table->text('ai_brand_voice_sample')->nullable()->after('ai_content_ideas');
            $table->enum('ai_status', ['pending','processing','completed','failed'])->default('pending')->after('ai_brand_voice_sample');
            $table->timestamp('ai_generated_at')->nullable()->after('ai_status');
        });
    }
    public function down(): void
    {
        Schema::table('survey_responses', function (Blueprint $table) {
            $table->dropColumn([
                'ai_strategic_diagnosis', 'ai_customer_narrative',
                'ai_action_plan_30day', 'ai_content_ideas',
                'ai_brand_voice_sample', 'ai_status', 'ai_generated_at',
            ]);
        });
    }
};
