<?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('whatsapp_groups', function (Blueprint $table) {
            $table->id();
            $table->string('target_type')->default('class'); // 'class', 'all_parents', 'teachers'
            $table->string('class_name')->nullable(); // e.g. 'X RPL 1'
            $table->string('group_name'); // e.g. 'Group Paguyuban Orang Tua X RPL 1'
            $table->string('group_target_id'); // e.g. '12036301234567890@g.us' or Fonnte/Wablas target
            $table->boolean('is_active')->default(true);
            $table->timestamps();
        });
    }

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