<?php

namespace App\Models;

use App\Traits\Owned;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Prunable;
use Illuminate\Database\Eloquent\SoftDeletes;

class BgpReroute extends Model
{
    use Prunable;
    use SoftDeletes;
    use Owned;

    protected $table = 'bgp_reroute';

    protected $fillable = [
        'address',
        'mask',
        'permanent_request',
        'city',
        'provider',
        'router',
        'reason',
        'expiration_at',
        'approved_at',
        'organisation_id'
    ];

    protected $casts = [
        'expiration_at' => 'datetime',
        'approved_at'   => 'datetime'
    ];

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