<?php

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

return new class extends Migration
{
    /**
     * Run the migrations.
     */
    public function up(): void
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->string('email')->nullable()->after('name');
            $table->string('plan')->default('starter')->after('address');
            $table->unsignedInteger('num_trucks')->default(1)->after('plan');
            $table->unsignedInteger('num_drivers')->default(1)->after('num_trucks');
            $table->unsignedBigInteger('owner_id')->nullable()->after('num_drivers');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('companies', function (Blueprint $table) {
            $table->dropColumn(['email', 'plan', 'num_trucks', 'num_drivers', 'owner_id']);
        });
    }
};
