<?php

namespace App\Models;

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

class SiteHealthLog extends Model
{
    use HasFactory;

    protected $fillable = [
        'website_id',
        'status',
        'health_status',
        'response_time_ms',
        'message',
        'payload',
        'checked_at',
    ];

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

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