<?php

namespace App\Models;

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

class RoomStatusLog extends Model
{
    use HasFactory;

    public $timestamps = true;

    protected $fillable = 
    [
        'branch_id', 
        'room_id', 
        'user_id', 
        'is_online',
        'status', 
        'started_at',
        'ended_at',
        'message', 
        'source',
    ];

    protected $casts = [
        'is_online' => 'boolean',
        'status' => \App\Enums\RoomStatus::class,
        'started_at' => 'datetime',
        'ended_at' => 'datetime',
        
    ];
    public function user(){
        return $this->belongsTo(User::class);
    }
    public function branch() {
        return $this->belongsTo(Branch::class);
    }
    public function room() {
        return $this->belongsTo(Room::class);
    }
    
}
