package com.yuchen.saas.parking.api.vo;

import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.format.DateTimeFormat;
import com.alibaba.excel.annotation.write.style.*;
import com.thinkunion.park.service.common.enums.parking.DiscountTypeEnum;
import com.yuchen.saas.parking.api.util.StringUtil;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.poi.ss.usermodel.HorizontalAlignment;

import java.util.Date;

/**
 * @Description 停车优惠导出excel
 */
@Data
@HeadStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@HeadRowHeight(25)
@ContentStyle(horizontalAlignment = HorizontalAlignment.CENTER)
@ColumnWidth(12)
@ContentRowHeight(15)
@HeadFontStyle(fontHeightInPoints =9)
@ExcelIgnoreUnannotated
public class ParkingCouponExcelVo {
    @ApiModelProperty(value = "优惠类型")
    private Integer discountType;

    @ExcelProperty("优惠类型")
    @ApiModelProperty("优惠类型")
    private String discountTypeValue;


    @ApiModelProperty(value = "优惠数值")
    private Integer discountNumber;

    @ExcelProperty("优惠(单位:元)")
    @ApiModelProperty(value = "优惠数值")
    private String discountNumberStr;



    @ApiModelProperty(value = "剩余优惠金额数值")
    private Integer totalDiscountNumber;

    @ExcelProperty("剩余金额(单位:元)")
    @ApiModelProperty(value = "剩余优惠金额数值")
    private String totalDiscountNumberStr;


    @ApiModelProperty(value = "总优惠金额数值")
    private Integer totalAmount;

    @ExcelProperty("总金额(单位:元)")
    @ApiModelProperty(value = "总优惠金额数值")
    private String totalAmountStr;

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

    /**
     * 开始时间
     */
    @ExcelProperty("有效开始时间")
    @ApiModelProperty(value = "开始时间")
    @DateTimeFormat(value = "yyyy-MM-dd HH:mm:ss")
    private Date beginTime;

    /**
     * 结束时间
     */
    @ExcelProperty("有效结束时间")
    @ApiModelProperty(value = "结束时间")
    @DateTimeFormat(value = "yyyy-MM-dd HH:mm:ss")
    private Date endTime;


    @ExcelProperty("创建时间")
    @ApiModelProperty("创建时间")
    @DateTimeFormat(value = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;


    public String getTotalAmountStr(){
        return StringUtil.formatFenToYuan(totalAmount);
    }

    public String getTotalDiscountNumberStr(){
        return StringUtil.formatFenToYuan(totalDiscountNumber);
    }

    public String getDiscountNumberStr(){
        return StringUtil.formatFenToYuan(discountNumber);
    }

    public String getDiscountTypeValue(){
        return DiscountTypeEnum.getDescByCode(discountType);
    }
}
