<?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('users', function (Blueprint $table) {
            $table->integer('profile_complete_percentage')->default(0)->after('last_login_at');
            $table->timestamp('onboarding_started_at')->nullable()->after('profile_complete_percentage');
            $table->timestamp('onboarding_completed_at')->nullable()->after('onboarding_started_at');
            $table->string('last_association_context')->nullable()->after('onboarding_completed_at');
            $table->boolean('is_onboarding_force_redirect')->default(false)->after('last_association_context');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn([
                'profile_complete_percentage',
                'onboarding_started_at',
                'onboarding_completed_at',
                'last_association_context',
                'is_onboarding_force_redirect',
            ]);
        });
    }
};
