package com.bizzan.bitrade.entity;

import lombok.Data;

import javax.persistence.*;
import java.util.Date;

@Entity
@Data
@Table(name = "device_blacklist")
public class DeviceBlacklist {

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

    @Column(name = "device_fingerprint", nullable = false, length = 64, unique = true)
    private String deviceFingerprint;

    @Column(length = 255)
    private String reason;

    @Column(name = "created_at", nullable = false)
    private Date createdAt;

    @PrePersist
    public void prePersist() {
        if (createdAt == null) createdAt = new Date();
    }
}
