<?php

namespace Modules\SmartStorage\Entities;

use Illuminate\Database\Eloquent\Model;

class SsOtpSession extends Model
{
    protected $table = 'ss_otp_sessions';

    protected $guarded = ['id'];

    protected $casts = [
        'verified_at' => 'datetime',
        'expires_at'  => 'datetime',
        'attempts'    => 'integer',
    ];

    public function isLive(): bool
    {
        return $this->verified_at !== null
            && $this->expires_at !== null
            && $this->expires_at->isFuture();
    }
}
