<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

return new class extends Migration
{
    public function up(): void
    {
        Schema::create('shops', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('owner_name')->nullable();
            $table->string('email')->nullable();
            $table->string('phone')->nullable();
            $table->string('address')->nullable();
            $table->string('city')->nullable();
            $table->string('gst_number')->nullable();
            $table->string('logo')->nullable(); // storage path, e.g. shops/logo1.png
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });

        // One shop to test with — the seeded Shop Owner / Staff users point to shop_id = 1
        DB::table('shops')->insert([
            'name' => 'Madurai Main',
            'owner_name' => 'Sample Owner',
            'city' => 'Madurai',
            'is_active' => true,
            'created_at' => now(),
            'updated_at' => now(),
        ]);
    }

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