package com.gci.boot.modules.finance.entity;

import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.excel.annotation.write.style.ColumnWidth;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonPropertyDescription;
import com.gci.boot.annotation.Query.OrderQuery;
import com.gci.boot.annotation.Query.SelectQuery;
import com.gci.boot.annotation.repeat.TableRepeat;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.dict.excel.DictConverter;
import com.gci.boot.common.validated.SaveValidated;
import com.gci.boot.common.validated.UpdateValidated;
import com.gci.boot.modules.basedata.entity.TbRepairShopArchives;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.Range;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;

/**
 * 车辆成本录入
 */
@Data
@TableName("tb_vehicle_cost")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value="车辆成本表对象", description="车辆成本表对象")
@TableRepeat(aClass = VehicleCost.class,groups = {SaveValidated.class, UpdateValidated.class})
public class VehicleCost implements Serializable {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @ExcelIgnore
    private String id;

    /**
     * 车辆种类
     */
    @NotBlank(message = "车型不能为空",groups = {SaveValidated.class, UpdateValidated.class})
    @Length(max = 100,groups = {SaveValidated.class,UpdateValidated.class},message = "车型长度不能超过100")
    @SelectQuery
    @ExcelProperty(value = "车型",index = 0)
    @ColumnWidth(value = 20)
    private String vehicleType;
    /**
     * 单价(万元)
     */
    @Range(min = 0, max = 100000, message = "单价(万元)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = "单价(万元)",index =1)
    @ColumnWidth(value = 20)
    private BigDecimal unitPrice;
    /**
     * 上牌费用/购置税(万元)
     */
    @Range(min = 0, max = 100000, message = "上牌费用/购置税(万元)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = "上牌费用/购置税(万元)",index =2)
    @ColumnWidth(value = 20)
    private BigDecimal purchaseTax;
    /**
     * 保险(万元/台/年)
     */
    @Range(min = 0, max = 100000, message = "保险(万元/台/年)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = "保险(万元/台/年)",index =3)
    @ColumnWidth(value = 20)
    private BigDecimal insurance;
    /**
     * 维修及易损件(万元)
     */
    @Range(min = 0, max = 100000, message = "维修及易损件(万元)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = "维修及易损件(万元)",index =4)
    @ColumnWidth(value = 20)
    private BigDecimal repair;
    /**
     * 保养(万元)
     */
    @Range(min = 0, max = 100000, message = "保养(万元)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = "保养(万元)",index =5)
    @ColumnWidth(value = 20)
    private BigDecimal upkeep;
    /**
     * 年审(万元)
     */
    @Range(min = 0, max = 100000, message = "年审(万元)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = "年审(万元)",index =6)
    @ColumnWidth(value = 20)
    private BigDecimal annualAudit;

    //租赁报价(万元/月/台)
    /**
     * 第一年
     */
    @Range(min = 0, max = 100000, message = "第一年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第一年"},index =7)
    @ColumnWidth(value = 20)
    private BigDecimal oneYear;
    /**
     * 第二年
     */
    @Range(min = 0, max = 100000, message = "第二年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第二年"},index =8)
    @ColumnWidth(value = 20)
    private BigDecimal twoYear;
    /**
     * 第三年
     */
    @Range(min = 0, max = 100000, message = "第三年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第三年"},index =9)
    @ColumnWidth(value = 20)
    private BigDecimal threeYear;
    /**
     * 第四年
     */
    @Range(min = 0, max = 100000, message = "第四年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第四年"},index =10)
    @ColumnWidth(value = 20)
    private BigDecimal fourYear;
    /**
     * 第五年
     */
    @Range(min = 0, max = 100000, message = "第五年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第五年"},index =11)
    @ColumnWidth(value = 20)
    private BigDecimal fiveYear;
    /**
     * 第六年
     */
    @Range(min = 0, max = 100000, message = "第六年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第六年"},index =12)
    @ColumnWidth(value = 20)
    private BigDecimal sixYear;
    /**
     * 第七年
     */
    @Range(min = 0, max = 100000, message = "第七年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第七年"},index =13)
    @ColumnWidth(value = 20)
    private BigDecimal sevenYear;
    /**
     * 第八年
     */
    @Range(min = 0, max = 100000, message = "第八年(万元/月/台)在[0,100000]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    @ExcelProperty(value = {"租赁报价(万元/月/台)", "第八年"},index =14)
    @ColumnWidth(value = 20)
    private BigDecimal eightYear;

    @JsonPropertyDescription("所属机构")
    @ExcelIgnore
    private String sysOrgCode;
    @JsonPropertyDescription("创建时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    @OrderQuery
    private Date createTime;
    @JsonPropertyDescription("更新时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date updateTime;
    @JsonPropertyDescription("创建人")
    @ExcelIgnore
    private String createBy;
    @JsonPropertyDescription("更新人")
    @ExcelIgnore
    private String updateBy;


    @ApiModelProperty("开始单价")
    @SelectQuery(Type = SelectQuery.SelectType.GE,PropName = "unitPrice")
    @ExcelIgnore
    @TableField(exist = false)
    private BigDecimal startCost;
    @ApiModelProperty("结束单价")
    @SelectQuery(Type = SelectQuery.SelectType.LE,PropName = "unitPrice")
    @ExcelIgnore
    @TableField(exist = false)
    private BigDecimal endCost;
}
