package com.izouma.dingdong.domain;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;

import javax.persistence.Column;
import javax.persistence.Entity;

@EqualsAndHashCode(callSuper = false)
@Data
@Entity
@AllArgsConstructor
@NoArgsConstructor
@Builder
//@Where(clause = "enabled = 1")
@ApiModel(value = "用户", description = "用户")
public class BankCard extends BaseEntity {

    //商家端和骑手端的用户Id
    @ApiModelProperty(value = "用户ID", name = "userId")
    private Long userId;

    @ApiModelProperty(value = "真实姓名", name = "realName")
    private String realName;

    @ApiModelProperty(value = "电话", name = "phone")
    private String phone;

    @ApiModelProperty(value = "身份证", name = "idNo")
    private String idNo;

    @ApiModelProperty(value = "银行", name = "bankName")
    private String bankName;

    @ApiModelProperty(value = "卡号", name = "cardNo")
    private String cardNo;

    @Column(nullable = false)
    private Boolean enabled = true;

    public String userInfo(){
        return bankName + " (" + cardNo.substring(cardNo.length() - 4) + ") " + realName;
    }

}

