package com.yuchen.saas.park.api.dto.property;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.thinkunion.park.service.common.utils.AmtUtil;
import lombok.Data;
import org.hibernate.validator.constraints.Range;

import javax.validation.constraints.Min;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;

@Data
public class PropertyChargeFeesOfflineDto {

    /**
     * 房源id
     */
    private Long houseId;
    /**
     * 账单ids
     */
    private List<Long> billIdList;

    /**
     * 实收金额；分
     */
    @JsonIgnore
    private long payAmtFen;

    public long getPayAmtFen() {
        return AmtUtil.yuanToFen(this.payAmt);
    }

    @NotNull(message = "实收金额不能为空", groups = {Default.class})
    @Positive(message = "实收金额必须大于0", groups = {Default.class})
    private BigDecimal payAmt;

    /**
     * 收款方式; 1-现金，2-第三方转账，3-银行卡转账
     */
    @NotNull(message = "付款方式不能为空", groups = {Default.class})
    @Min(value = 1, message = "收款方式参数不正确")
    private Integer payType;

    /**
     * 付款时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @NotNull(message = "付款时间不能为空", groups = {Default.class})
    private Date recordTime;
    /**
     * 付款人员
     */
    @NotNull(message = "付款人员不能为空", groups = {Default.class})
    private String payUser;
    /**
     * 收费人员
     */
    @NotNull(message = "收费人员不能为空", groups = {Cash.class})
    private String receiveUser;
    /**
     * 第三方类型; 1-微信，2-支付宝
     */
    @NotNull(message = "选择第三方不能为空", groups = {Third.class})
    private Integer thirdPartyType;
    /**
     * 付款银行
     */
    @NotNull(message = "付款银行不能为空", groups = {Bank.class})
    private String payBank;
    /**
     * 付款账户
     */
    @NotNull(message = "付款账户不能为空", groups = {Third.class, Bank.class})
    private String payAccount;
    /**
     * 收款银行
     */
    @NotNull(message = "收款银行不能为空", groups = {Bank.class})
    private String receiveBank;
    /**
     * 收款账户
     */
    @NotNull(message = "收款账户不能为空", groups = {Third.class, Bank.class})
    private String receiveAccount;
    /**
     * 交易单号
     */
    @NotNull(message = "交易单号不能为空", groups = {Third.class})
    private String transactionNum;
    /**
     * 交易截图
     */
    @NotNull(message = "交易截图不能为空", groups = {Default.class})
    private String filePath;
    /**
     * 备注
     */
    private String remark;

    public interface Default {} //默认

    public interface Cash {} // 现金

    public interface Third {} // 第三方

    public interface Bank {} // 银行卡

}
