<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class EmailLog extends Model
{
    protected $fillable = [
        'template_slug',
        'recipient_email',
        'recipient_name',
        'subject',
        'body',
        'status',
        'send_method',
        'error_message',
        'sent_at'
    ];

    protected $casts = [
        'sent_at' => 'datetime'
    ];

    public function template()
    {
        return $this->belongsTo(EmailTemplate::class, 'template_slug', 'slug');
    }
}
