<?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('quotation_settings', function (Blueprint $table) {
            if (! Schema::hasColumn('quotation_settings', 'require_salesperson')) {
                $table->boolean('require_salesperson')->default(false)->after('notes');
            }
            if (! Schema::hasColumn('quotation_settings', 'show_salesperson_on_pdf')) {
                $table->boolean('show_salesperson_on_pdf')->default(true)->after('require_salesperson');
            }
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::table('quotation_settings', function (Blueprint $table) {
            $table->dropColumn(['require_salesperson', 'show_salesperson_on_pdf']);
        });
    }
};
