package com.xfestudio.xfeservermanager.infra.security;

import java.time.Instant;
import java.util.UUID;

public record AccountRecord(
        UUID id,
        String username,
        String normalizedUsername,
        String passwordHash,
        Role role,
        byte[] encryptedTotpSecret,
        boolean totpEnabled,
        boolean disabled,
        Instant createdAt,
        Instant updatedAt,
        Instant lastLoginAt) {

    public AccountRecord {
        encryptedTotpSecret = encryptedTotpSecret == null ? null : encryptedTotpSecret.clone();
    }

    @Override
    public byte[] encryptedTotpSecret() {
        return encryptedTotpSecret == null ? null : encryptedTotpSecret.clone();
    }
}

