<?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('certificate_templates', function (Blueprint $table) {
            $table->id();
            $table->branchColumn();
            $table->string('name');
            $table->enum('type', ['character', 'bonafide', 'leaving', 'experience', 'custom'])->default('custom');
            $table->text('body');                 // supports {{placeholders}}
            $table->boolean('is_active')->default(true)->index();
            $table->auditColumns();
            $table->timestamps();
            $table->softDeletes();
        });
    }

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