<?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::create('products', function (Blueprint $table) {
            $table->id();
            $table->foreignId('seller_id')->constrained('sellers')->onDelete('cascade');
            $table->foreignId('category_id')->constrained('categories');
            $table->string('name');
            $table->text('description');
            $table->decimal('price', 10, 2);
            $table->integer('moq')->default(1);
            $table->json('images_json')->nullable();
            $table->boolean('is_highlighted')->default(false);
            $table->integer('plan_limit')->default(0); // Maybe this refers to how much it counts towards limit? Or if it's allowed by plan? Assuming just a field.
            $table->timestamps();
        });
    }

    public function down(): void
    {
        Schema::dropIfExists('products');
    }
};
