package com.bizzan.bitrade.entity;

import java.math.BigDecimal;
import java.util.Date;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.OneToMany;

import org.hibernate.annotations.OrderBy;
import org.hibernate.annotations.Where;

import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

@Entity
@Data
public class FollowWallet implements IWallet {

	@Id
    private Long id;
	
    @ApiModelProperty("账户余额")
	@Column(columnDefinition = "decimal(18,8) comment '可用余额'")
    private BigDecimal balance;
    @ApiModelProperty("已用保证金")
    @Column(columnDefinition = "decimal(18,8) comment '冻结余额'")
    private BigDecimal frozenBalance;
    
    @ApiModelProperty("冻结保证金")
    private BigDecimal frozenMargin;
    
    private BigDecimal specialBalance;
    private BigDecimal specialFrozenBalance;
    private BigDecimal specialFrozenMargin;

    @ApiModelProperty("杠杆")
    private BigDecimal leverage;
    
    private BigDecimal profitPercent;
    private BigDecimal lossPercent;
    
    private Integer entrustStatus;
    private Date unfreezeTime;
    private BigDecimal frozenCt;
    private Integer mStatus;
    private Date mTime;
    
    
    @OneToMany(cascade = CascadeType.ALL, mappedBy = "memberId", fetch = FetchType.EAGER)
    //@Where(clause="status<>2 and follow_position_id is not null and is_special is null")
    @Where(clause="status<>2 and follow_position_id is not null")
    @OrderBy(clause = "createTime desc")
    private Set<MemberContractPosition> currentPositionList;
}
