<?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('products', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('sku')->unique();
            $table->float('purchase_price')->nullable();
            $table->float('price');
            $table->float('commission_percentage');
            $table->unsignedBigInteger('user_id');
            $table->text('description')->nullable();
            $table->dateTime('live_date');
            $table->integer('duration_day');
            $table->dateTime('finish_date');
            $table->enum('status', ['Draft', 'Pending', 'Approved', 'Rejected']);
            $table->foreign('user_id')->references('id')->on('users')->onDelete('cascade');
            $table->timestamps();
            $table->softDeletes();
        });
    }

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