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

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.thinkunion.park.service.common.utils.AmtUtil;
import com.yuchen.saas.park.api.enums.property.CalcTypeEnum;
import com.yuchen.saas.park.api.enums.property.FeeMarkEnum;
import com.yuchen.saas.park.api.enums.property.MonthDayEnum;
import com.yuchen.saas.park.api.enums.property.PriceUnitTypeEnum;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.nest.springwrap.core.tool.utils.Func;

import java.math.BigDecimal;

@Data
public class PropertyFeeStandardListVo {

    @ApiModelProperty(value = "id")
    private Long id;

    @ApiModelProperty(value = "园区名称")
    private String parkName;

    @ApiModelProperty(value = "费用项目名称")
    private String feeItemName;

    @ApiModelProperty(value = "收费标准名称")
    private String feeName;

    private Integer feeMark;
    @ApiModelProperty(value = "费用标识名称")
    private String feeMarkName;

    @JsonIgnore
    private Integer calcType;
    @ApiModelProperty(value = "计量方式名称")
    private String calcTypeName;

    @JsonIgnore
    private Long priceFen;
    @ApiModelProperty(value = "收费标准")
    private BigDecimal price;
    public BigDecimal getPrice() {
        return AmtUtil.fenToYuanObj(priceFen);
    }

    @JsonIgnore
    private Integer cycleType;
    @ApiModelProperty(value = "计费周期名称")
    private String cycleTypeName;

    @JsonIgnore
    private Integer priceUnitType;
    @ApiModelProperty(value = "收费标准单位名称")
    private String priceUnitTypeName;

    @ApiModelProperty(value = "账单周期")
    private Integer billCycle;

    @ApiModelProperty(value = "账单周期单位名称")
    private String billUnitName;

    @ApiModelProperty(value = "备注")
    private String remark;

    public String getFeeMarkName() {
        return FeeMarkEnum.convert(this.feeMark).getDesc();
    }

    public String getCycleTypeName() {
        if (Func.isEmpty(cycleType)) {
            return "";
        }
        return MonthDayEnum.convert(this.cycleType).getDesc();
    }

    public String getCalcTypeName() {
        if (Func.isEmpty(calcType)) {
            return "";
        }
        return CalcTypeEnum.convert(this.calcType).getDesc();
    }

    public String getPriceUnitTypeName() {
        if (Func.isEmpty(priceUnitType)) {
            return "";
        }
        return PriceUnitTypeEnum.convert(this.priceUnitType).getDesc();
    }

}
