<?php

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

/**
 * Tills are simple now: name + branch is enough to identify one at the
 * counter. `location` duplicated what the name/branch already say, and
 * `type` (sales device vs. till machine) was never read by any POS logic —
 * both were pure data entry with no behaviour behind them.
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::table('tills', function (Blueprint $table) {
            $table->dropColumn(['location', 'type']);
        });
    }

    public function down(): void
    {
        Schema::table('tills', function (Blueprint $table) {
            $table->string('location', 255)->nullable()->after('branch_id');
            $table->enum('type', ['sales_device', 'till_machine'])->default('till_machine')->after('invoice_prefix');
        });
    }
};
