package com.izouma.nineth.domain;

import com.izouma.nineth.enums.BalanceType;
import com.izouma.nineth.enums.PayMethod;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import javax.persistence.*;
import java.math.BigDecimal;
import java.time.LocalDateTime;

@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Table(indexes = {
        @Index(columnList = "userId")
})
public class BalanceRecord extends BaseEntity {

    private Long userId;

    private LocalDateTime time;

    @Column(precision = 10, scale = 2)
    private BigDecimal amount;

    @Column(precision = 10, scale = 2)
    private BigDecimal balance;

    @Column(precision = 10, scale = 2)
    private BigDecimal lastBalance;

    @Enumerated(EnumType.STRING)
    @Column(length = 20)
    private BalanceType type;

    private Long orderId;

    private String withdrawId;

    private String remark;

    private String extra;

    @Enumerated(EnumType.STRING)
    @Column(length = 20)
    private PayMethod payMethod;

}
