<?php

namespace App\Models\Goliath;

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

class MitigationEventQueue extends Model
{
    use HasFactory, Prunable;

    protected $table = 'mitigation_event_queue';

    protected $fillable = [
        'created_at',
        'updated_at',
        'started_at',
        'finished_at',
        'type',
        'description',
        'destination',
        'appliance_id',
        'processed_at'
    ];

    protected $casts = [
        'created_at'    => 'datetime',
        'updated_at'    => 'datetime',
        'started_at'    => 'datetime',
        'finished_at'   => 'datetime',
        'processed_at'  => 'datetime',
    ];

    public function prunable() {
        return static::where('created_at', '<=', now()->subDays(14));
    }
}
