package kr.co.accura.wbx.spring.auth;

import jakarta.persistence.*;
import kr.co.accura.wbx.spring.common.BaseEntity;
import lombok.*;

@Entity
@Table(name = "wbx_totp_secrets")
@Getter @Setter
@NoArgsConstructor @AllArgsConstructor @Builder
public class WbxTotpSecret extends BaseEntity {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @Column(nullable = false, unique = true)
    private Long userId;

    /** AES-256 암호화된 TOTP 시크릿 */
    @Column(nullable = false, length = 500)
    private String encryptedSecret;

    /** MFA 설정 완료 (QR 스캔 후 검증 통과) */
    @Builder.Default
    private boolean verified = false;

    /** JSON 배열 — 해시된 백업 코드 (1회용 복구 코드) */
    @Column(length = 2000)
    private String backupCodes;
}
