<?php

namespace App\Domain\Identity\Models;

use App\Domain\Shared\Traits\BelongsToAcademy;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\Relations\BelongsTo;

class LoginHistory extends Model
{
    use BelongsToAcademy;
    public $timestamps = false;

    protected $table = 'login_history';

    protected $fillable = [
        'user_id', 'academy_id', 'ip_address', 'user_agent',
        'status', 'failed_reason',
    ];

    const CREATED_AT = 'created_at';
    const UPDATED_AT = null;

    protected $casts = [
        'created_at' => 'datetime',
    ];

    public function user(): BelongsTo
    {
        return $this->belongsTo(\App\Models\User::class);
    }
}
