<?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('sellers', function (Blueprint $table) {
            $table->id();
            $table->foreignId('user_id')->constrained('users')->onDelete('cascade');
            $table->string('company_name');
            $table->string('gst')->nullable();
            $table->string('iec')->nullable();
            $table->string('state')->nullable();
            $table->string('country')->nullable();
            $table->integer('moq')->default(0);
            $table->boolean('is_verified')->default(false);
            $table->foreignId('subscription_id')->nullable()->constrained('subscriptions');
            $table->timestamps();
        });
        
        // Now add the constraint to subscriptions table for seller_id if needed, or just leave it indexed.
        // Schema::table('subscriptions', function (Blueprint $table) {
        //     $table->foreign('seller_id')->references('id')->on('sellers');
        // });
    }

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