<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;

class AlertLog extends Model
{
    use HasFactory;

    protected $fillable = [
        'alert_id',
        'employee_id',
        'message',
        'type',
        'priority',
        'sent_by',
        'sent_at',
        'acknowledged_at',
        'status'
    ];

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

    public function employee()
    {
        return $this->belongsTo(Employee::class, 'employee_id', 'employee_id');
    }

    public function sender()
    {
        return $this->belongsTo(User::class, 'sent_by');
    }
}