<?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::table('contact_templates', function (Blueprint $table) {
            // 'client' | 'scheme' | 'user' | 'institution'
            // null / absent treated as 'client' for backwards compatibility
            $table->string('recipient_type', 32)->nullable()->after('applies_to_type');
        });
    }

    public function down(): void
    {
        Schema::table('contact_templates', function (Blueprint $table) {
            $table->dropColumn('recipient_type');
        });
    }
};
