<?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('schools', function (Blueprint $table) {
            $table->id();
            $table->string('name');
            $table->string('code')->unique();                    // e.g. "KNA001", "NBI002"
            $table->string('type')->default('primary');          // primary, secondary, college, mixed
            $table->string('address')->nullable();
            $table->string('city')->nullable();
            $table->string('county')->nullable();                // e.g. Nairobi, Bungoma
            $table->string('phone')->nullable();
            $table->string('email')->nullable();
            $table->string('logo')->nullable();                  // path to school logo
            $table->string('status')->default('active');         // active, inactive, trial
            $table->integer('student_count')->default(0);
            $table->integer('teacher_count')->default(0);
            $table->timestamps();
        });
    }

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