<?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('workspace_invitations', function (Blueprint $table) {
            // Per-member AI token allocation chosen at invite time. Applied to
            // the tenant_user pivot when the invite is accepted. null = the
            // invitee shares the workspace pool (uncapped); 0 = no AI. Only
            // meaningful for editor/admin invites (viewers can't spend AI).
            $table->unsignedInteger('ai_tokens_monthly')->nullable()->after('role');
        });
    }

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