<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

/**
 * PRC-1143 — konsolide şema: `emails` tablosunun TAM tanımı (tek dosya).
 */
return new class extends Migration
{
    public function up(): void
    {
        Schema::create('emails', function (Blueprint $t) {
            $t->id();
            $t->unsignedInteger('client_id')->nullable();
            $t->unsignedInteger('contact_id')->nullable();
            $t->unsignedInteger('admin_id')->nullable();
            $t->string('to_address', 255);
            $t->string('from_address', 255);
            $t->string('bcc_address', 255)->nullable();
            $t->string('subject', 255);
            $t->text('content');
            $t->timestamp('created_at')->nullable();
            $t->timestamp('updated_at')->nullable();
        });
    }

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