import { BaseEntity } from "@cv/system"; export class RefreshToken extends BaseEntity { constructor( id: string, public token: string, public userId: string, public expiresAt: Date, createdAt: Date, updatedAt: Date, public userAgent: string | null = null, public ipAddress: string | null = null, public deviceName: string | null = null, public deviceType: string | null = null, public country: string | null = null, public city: string | null = null, public usedAt: Date | null = null, ) { super(id, createdAt, updatedAt); } get isExpired(): boolean { return this.expiresAt < new Date(); } get isUsed(): boolean { return this.usedAt !== null; } get isValid(): boolean { return this.isExpired ? false : !this.isUsed; } }