<?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('zones', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->foreignId('state_id')->constrained('states')->cascadeOnDelete();
            $table->enum('zone_type', ['Residential', 'Commercial', 'Industrial', 'Mixed', 'Agricultural', 'Green Belt', 'Heritage']);
            $table->decimal('far_fsi', 5, 2)->nullable();
            $table->decimal('max_height_m', 8, 2)->nullable();
            $table->decimal('max_ground_coverage', 5, 2)->nullable();
            $table->decimal('front_setback_m', 6, 2)->nullable();
            $table->decimal('side_setback_m', 6, 2)->nullable();
            $table->decimal('rear_setback_m', 6, 2)->nullable();
            $table->decimal('open_space_pct', 5, 2)->nullable();
            $table->text('permitted_uses')->nullable();
            $table->text('notes')->nullable();
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });
    }

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