<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class TicketEmailLog extends Model
{
    protected $fillable = [
        'department_id',
        'ticket_id',
        'reply_id',
        'from_email',
        'from_name',
        'subject',
        'message_id',
        'action', // created_ticket, added_reply, skipped, failed
        'error_message',
        'source_mailbox',
    ];

    public function department()
    {
        return $this->belongsTo(TicketDepartment::class, 'department_id');
    }

    public function ticket()
    {
        return $this->belongsTo(Ticket::class);
    }
}
