<?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('campuses', function (Blueprint $table) {
            $table->id();
            
            // Kolom relasi ke database SIADAK, menggantikan kolom 'name'
            $table->unsignedBigInteger('siakad_kampus_id')->unique(); // ID unik dari tabel kampus di SIADAK
            
            $table->string('slug')->unique(); // Tetap diperlukan untuk URL PMB
            $table->text('description')->nullable();
            
            // Logo & Background
            $table->string('logo_url')->nullable();
            $table->string('logo_url_horizontal')->nullable();
            $table->string('footer_background_url')->nullable();
            $table->string('banner_url')->nullable(); 
            
            // Kontak Dasar
            $table->string('whatsapp_number')->nullable(); 
            $table->string('phone_number')->nullable(); 
            $table->string('email')->nullable(); 
            
            // Alamat Lengkap (Masih diperlukan untuk info kontak)
            $table->string('address')->nullable();
            $table->string('city')->nullable();
            $table->string('province')->nullable();
            
            // Map/Peta
            $table->string('map_embed_url')->nullable(); 
            $table->double('latitude')->nullable(); 
            $table->double('longitude')->nullable(); 
            
            // Social Media & Theme
            $table->json('social_media')->nullable(); 
            $table->json('theme_config')->nullable(); 

            $table->timestamps();
            
            // Catatan: Tidak perlu foreign key constraint jika relasinya antar database berbeda
        });
    }

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