package com.bizzan.bitrade.entity;

import lombok.Data;
import org.hibernate.annotations.CreationTimestamp;

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

@Entity
@Data
@Table(name = "member_device",
        uniqueConstraints = @UniqueConstraint(columnNames = {"member_id", "device_fingerprint"}))
public class MemberDevice {

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

    @Column(name = "member_id", nullable = false)
    private Long memberId;

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

    @Column(name = "device_type")
    private Integer deviceType;

    @Column(name = "device_model", length = 128)
    private String deviceModel;

    @Column(name = "os_version", length = 64)
    private String osVersion;

    @Column(name = "first_login_time", nullable = false)
    private Date firstLoginTime;

    @Column(name = "last_login_time", nullable = false)
    private Date lastLoginTime;

    @Column(name = "last_login_ip", length = 64)
    private String lastLoginIp;

    @Column(name = "login_count", nullable = false)
    private int loginCount = 1;
}
