<?php

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

/**
 * Single-Session Enforcement: Add force_logout_reason to users table
 * 
 * This supports differentiated force-logout messages:
 * - 'admin_force_logout' → Terminated by administrator
 * - 'password_reset' → Password was reset by admin
 * - 'account_deactivated' → Account was deactivated
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->string('force_logout_reason', 50)->nullable()->after('force_logout');
        });
    }

    public function down(): void
    {
        Schema::table('users', function (Blueprint $table) {
            $table->dropColumn('force_logout_reason');
        });
    }
};
