<?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('inventories', function (Blueprint $table) {
            $table->id();

            $table->string('name');
            $table->string('code')->unique();
            $table->string('description')->nullable();

            $table->string('email')->nullable();
            $table->string('phone_number')->nullable();

            $table->string('street_address')->nullable();

            $table->integer('zipcode')->nullable();
            $table->string('region');
            $table->foreignId('province_id')->nullable()->constrained()->cascadeOnDelete();

            $table->string('longitude')->nullable();
            $table->string('latitude')->nullable();
            $table->boolean('is_default')->default(false);

            $table->foreignId('channel_id')->nullable()->constrained()->cascadeOnDelete();

            $table->timestamps();
        });
    }

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