<?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::create('order_products', function (Blueprint $table) {
            $table->id();
            $table->enum('pm_type', ["wallet","stripe"]);
            $table->integer('quantity');
            $table->decimal('total_price');
            $table->boolean('is_paid')->default(false);
            $table->enum('status', ["pending","failed","completed"]);
            $table->foreignId('product_id');
            $table->foreignId('user_id');
            $table->foreignId('coupon_id')->nullable();
            $table->text('address');
            $table->foreignId('wallet_transaction_id')->nullable();
            $table->timestamps();
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down(): void
    {
        Schema::dropIfExists('order_products');
    }
};
