<?php

namespace App\Models;

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

class ShowroomSession extends Model
{
    use HasFactory;

    protected $guarded = ['id'];

    protected $casts = [
        'admin_id' => 'integer',
        'pos_device_id' => 'integer',
        'abilities' => 'array',
        'expires_at' => 'datetime',
        'last_used_at' => 'datetime',
        'revoked_at' => 'datetime',
    ];

    public function admin()
    {
        return $this->belongsTo(Admin::class);
    }

    public function device()
    {
        return $this->belongsTo(PosDevice::class, 'pos_device_id');
    }
}
