<?php

namespace App\Models;

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

class BastionAccount extends Model
{
    use HasFactory;

    protected $fillable = [
        'name',
        'username',
        'password',
        'usm_authentication',
        'usm',
        'last_token_refreshed_at',
        'is_active',
    ];

    public function accessLogs(): HasMany
    {
        return $this->hasMany(AccessLog::class);
    }

    protected function casts(): array
    {
        return [
            'password' => 'encrypted',
            'is_active' => 'boolean',
            'last_token_refreshed_at' => 'datetime',
        ];
    }
}
