<?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::table('scoli', function (Blueprint $table) {
            $table->boolean('notificari_email')->default(false)->after('email');
            $table->boolean('notificari_whatsapp')->default(false)->after('notificari_email');
            $table->string('whatsapp_api_url')->nullable()->after('notificari_whatsapp');
            $table->string('whatsapp_api_key')->nullable()->after('whatsapp_api_url');
        });

        Schema::table('clase', function (Blueprint $table) {
            $table->boolean('notificari_email')->nullable()->after('tip_perioada');
            $table->boolean('notificari_whatsapp')->nullable()->after('notificari_email');
        });
    }

    public function down(): void
    {
        Schema::table('scoli', function (Blueprint $table) {
            $table->dropColumn(['notificari_email', 'notificari_whatsapp', 'whatsapp_api_url', 'whatsapp_api_key']);
        });

        Schema::table('clase', function (Blueprint $table) {
            $table->dropColumn(['notificari_email', 'notificari_whatsapp']);
        });
    }
};
