<?php

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

return new class extends Migration
{
    public function up()
    {
        // Add flags to track manual edits
        Schema::table('categories', function (Blueprint $table) {
            $table->boolean('manual_image')->default(false)->after('image');
            $table->boolean('manual_description')->default(false)->after('description');
            $table->boolean('manual_name')->default(false)->after('name');
        });

        Schema::table('products', function (Blueprint $table) {
            $table->boolean('manual_image')->default(false)->after('image');
            $table->boolean('manual_description')->default(false)->after('description');
            $table->boolean('manual_name')->default(false)->after('name');
            $table->boolean('manual_price')->default(false)->after('selling_price');
        });
    }

    public function down()
    {
        Schema::table('categories', function (Blueprint $table) {
            $table->dropColumn(['manual_image', 'manual_description', 'manual_name']);
        });

        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn(['manual_image', 'manual_description', 'manual_name', 'manual_price']);
        });
    }
};
