<?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('tenants', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('slug')->unique();
            $table->string('domain')->nullable()->unique();

            $table->string('contact_name')->nullable();
            $table->string('contact_email')->nullable();
            $table->string('contact_phone')->nullable();

            // Simple event-credit based monetization (MVP)
            $table->integer('event_credits_balance')->default(1);
            $table->timestamp('free_event_granted_at')->nullable();

            // Limits & quotas
            $table->integer('max_photos_per_event')->default(500);
            $table->integer('max_storage_mb')->default(1024);

            // Feature flags & misc
            $table->json('features')->nullable();
            $table->timestamp('last_activity_at')->nullable();

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

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

