<?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('products', function (Blueprint $table) {
            // Discounts
            $table->decimal('min_order_amount_for_discount', 15, 2)->nullable()->after('max_discount_percentage');
            $table->decimal('original_min_order_amount', 15, 2)->nullable()->after('min_order_amount_for_discount');
            
            // Shipping
            $table->string('shipping_charge_type')->default('flat_rate')->after('shipping_charge'); // 'flat_rate' or 'per_item'
        });
    }

    public function down(): void
    {
        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn([
                'min_order_amount_for_discount', 
                'original_min_order_amount', 
                'shipping_charge_type'
            ]);
        });
    }
};