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

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.thinkunion.park.service.common.utils.AmtUtil;
import com.yuchen.saas.park.api.dto.property.PropertyPaymentRefundAccountDto;
import com.yuchen.saas.park.api.entity.property.PropertyBusinessChargesDetail;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

@Data
public class PropertyBusinessChargesViewVo {

    private Long id;
    /**
     * 园区Id
     */
    private Long parkId;
    /**
     * 园区名称
     */
    private String parkName;

    private Long customerId;
    /**
     * 客户名称
     */
    private String customerName;
    /**
     * 收费状态 0-未收，1-已收
     */
    private int chargeType;

    /**
     * 费用明细
     */
    private List<PropertyBusinessChargesDetail> detailList;

    /**
     * 收款信息
     */
    private PayDataInfo payDataInfo;

    /**
     * 退款信息
     */
    private RefundDataInfo refundDataInfo;

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class PayDataInfo extends PropertyPaymentRefundAccountDto {

        /**
         * 费用合计（应收金额合计）
         */
        @JsonIgnore
        private long noPayAmtFen;
        private BigDecimal noPayAmt;
        public BigDecimal getNoPayAmt() {
            return AmtUtil.fenToYuan(this.noPayAmtFen);
        }
        /**
         * 收款实付金额
         */
        @JsonIgnore
        private long payAmtFen;
        private BigDecimal payAmt;
        public BigDecimal getPayAmt() {
            return AmtUtil.fenToYuan(this.payAmtFen);
        }
        /**
         * 收款备注
         */
        private String payRemark;

        @JsonIgnore
        private Long createUser;
        /**
         * 创建人
         */
        private String createUserName;
        /**
         * 创建时间
         */
        @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
        private Date createTime;
    }

    @Data
    @EqualsAndHashCode(callSuper = true)
    public static class RefundDataInfo extends PropertyPaymentRefundAccountDto {

        /**
         * 退款金额
         */
        @JsonIgnore
        private long refundAmtFen;
        private BigDecimal refundAmt;
        public BigDecimal getRefundAmt() {
            return AmtUtil.fenToYuan(this.refundAmtFen);
        }
        /**
         * 退款备注
         */
        private String refundRemark;

    }

}
