<?php

namespace App\Models;

use App\Models\Device;
use Illuminate\Database\Eloquent\Concerns\HasUuids;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class LocationTransaction extends Model
{
    use HasFactory, HasUuids;

    /**
     * The table associated with the model.
     * @var string
     */
    protected $table = 'location_transactions';

    /**
     * The primary key associated with the devices table.
     * @var string
     */
    protected $primaryKey = 'location_transaction_id';

    /**
     * The attributes that are mass assignable.
     *
     * @var array<int, string>
     */
    protected $fillable = ['location_transaction_id', 'room_code', 'timestamp_located_since', 'device_id'];

    public function device(): BelongsTo {
        return $this->belongsTo(Device::class, 'device_id', 'device_id');
    }

    //Timestamps are disabled.
    public $timestamps = false;
}