<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class ImpersonationLog extends Model
{
    protected $fillable = [
        'platform_user_id',
        'tenant_id',
        'reason',
        'started_at',
        'ended_at',
        'ip_address',
        'user_agent',
        'session_id',
    ];

    protected $casts = [
        'started_at' => 'datetime',
        'ended_at' => 'datetime',
    ];

    public function staff()
    {
        return $this->belongsTo(User::class, 'platform_user_id');
    }

    public function tenant()
    {
        return $this->belongsTo(Tenant::class);
    }
}
