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 javax.validation.constraints.NotNull;
import javax.validation.constraints.Positive;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 临时收费账单
 */
@Data
public class PropertyTempBillCreateDto {
//    /**
//     * 操作类型，是否收费：1-是，0-否 （仅生成账单）
//     */
//    @NotNull(message = "操作类型参数不能为空")
//    private Integer isPay;
    /**
     * 原区id
     */
    @NotNull(message = "原区id不能为空")
    private Long parkId;
    /**
     * 客户id
     */
    @NotNull(message = "客户id不能为空")
    private Long customerId;
    /**
     * 楼栋id
     */
    @NotNull(message = "楼栋id不能为空")
    private Long buildingId;
    /**
     * 房源id
     */
    @NotNull(message = "房源id不能为空")
    private Long houseId;
    /**
     * 收费标准id
     */
    @NotNull(message = "收费标准id不能为空")
    private Long feeId;
    /**
     * 价格
     */
    private Long priceFen;
    public Long getPriceFen() {
        return AmtUtil.yuanToFenObj(this.price);
    }

    private BigDecimal price;
    /**
     * 计费数量
     */
    private Long billableQuantity;

    @JsonIgnore
    private long receivableAmtFen;
    public long getReceivableAmtFen() {
        return AmtUtil.yuanToFen(this.receivableAmt);
    }

    /**
     * 收费金额
     */
    @NotNull(message = "收费金额不能为空")
    @Positive(message = "收费金额必须大于")
    private BigDecimal receivableAmt;

    /**
     * 开始日期
     */
    @NotNull(message = "开始日期不能为空")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date startDate;
    /**
     * 结束日期
     */
    @NotNull(message = "开始日期不能为空")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    private Date endDate;

    /**
     * 临时收费id
     */
    private Long temporaryChargesId;

}
