<?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('stores', function (Blueprint $table) {
            $table->id();
            $table->string('name')->nullable();
            $table->string('phone')->nullable();
            $table->string('email')->nullable();
            $table->tinyInteger('status_active')->nullable();
            $table->string('min_order')->nullable();
            $table->string('logo')->nullable();
            $table->string('header')->nullable();
            $table->date('expire_subscribe')->nullable();
            $table->string('bank_account')->nullable();
            $table->string('bank_num')->nullable();
            $table->string('iban')->nullable();
            $table->string('bank')->nullable();
            $table->tinyInteger('status_account')->nullable();
            $table->string('user_id_front_image')->nullable();
            $table->string('user_id_back_image')->nullable();
            $table->string('iban_card')->nullable();
            $table->string('license_work')->nullable();
            $table->string('commercial_log')->nullable();
            $table->string('manager_id')->nullable();
            $table->string('contract_establish')->nullable();
            $table->string('owner_id')->nullable();

            $table->unsignedBigInteger('category_id')->nullable();
            $table->foreign('category_id')->references('id')->on('categories')->onDelete('cascade')->onUpdate('cascade');

            $table->unsignedBigInteger('sub_category_id')->nullable();
            $table->foreign('sub_category_id')->references('id')->on('categories')->onDelete('cascade')->onUpdate('cascade');
            $table->softDeletes();
            $table->timestamps();

            $table->engine = 'InnoDB';
        });
    }

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