<?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('orders', function (Blueprint $table) {
            $table->id('order_id');
            $table->foreignId('order_userid')->references('normalUser_id')->on('normalusers');
            $table->foreignId('order_addressid')->references('normaluserAddress_id')->on('normaluseraddress');
            $table->foreignId('order_state_id')->references('order_state_id')->on('order_states');
            // 0 = Payment has not been made ----------- 1 = Payment has been made
            $table->integer('order_paymentStatus')->default(0);
            // 0 = cash ----------- 1 = online
            $table->integer('order_paymentmethod');
            $table->integer('order_delivery');
            $table->integer('order_coupon');
            $table->integer('order_price');
            $table->dateTime('order_EstimatedDate');
            $table->integer('order_discount')->default(0);
            $table->foreignId('order_vendor_id')->references('vendor_id')->on('vendors');
            $table->foreignId('order_country_id')->references('country_id')->on('countries');
            $table->timestamps();
        });
    }

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