<?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('properties', function (Blueprint $table) {
            $table->id();
            $table->unsignedBigInteger('id_categ');
            $table->foreign('id_categ')->references('id')->on('categories')->onDelete('cascade');
            
            $table->string("prop_name");
            $table->text("description");
            $table->string("kecamatan");
            $table->string("kota");
            $table->string("address");
            $table->text('maps_iframe')->nullable();
            $table->integer("total_floor")->nullable();
            $table->integer("total_rooms")->nullable();
            $table->decimal('base_price', 15, 2)->default(0);
            $table->decimal('promo_price', 15, 2)->default(0);
            $table->enum('status', ['on', 'off'])->default("off");
            $table->timestamps();
            $table->softDeletes();
        });
    }

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