<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class MaintenanceNotification extends Model
{
    protected $fillable = ['maintenance_window_id', 'customer_id', 'event', 'email', 'sent_at', 'claimed_at'];

    protected function casts(): array
    {
        return ['sent_at' => 'datetime', 'claimed_at' => 'datetime'];
    }

    public function window(): BelongsTo
    {
        return $this->belongsTo(MaintenanceWindow::class, 'maintenance_window_id');
    }

    public function customer(): BelongsTo
    {
        return $this->belongsTo(Customer::class);
    }
}
