<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ServerHeartbeat extends Model
{
    public $timestamps = false;

    protected $fillable = ['fivem_server_id', 'player_count', 'max_players', 'resources', 'recorded_at'];

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

    public function server()
    {
        return $this->belongsTo(FiveMServer::class, 'fivem_server_id');
    }
}
