<?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) {
            $table->string('coupon_code')->nullable()->after('specifications');
            $table->decimal('discount_percentage', 5, 2)->nullable()->after('coupon_code');
            $table->decimal('max_discount_percentage', 5, 2)->nullable()->after('discount_percentage');
            $table->boolean('is_free_shipping')->default(false)->after('max_discount_percentage');
            $table->decimal('shipping_charge', 10, 2)->nullable()->after('is_free_shipping');
        });
    }

    public function down(): void
    {
        Schema::table('products', function (Blueprint $table) {
            $table->dropColumn([
                'coupon_code', 
                'discount_percentage', 
                'max_discount_percentage', 
                'is_free_shipping', 
                'shipping_charge'
            ]);
        });
    }
};