package com.gci.boot.modules.vehicles.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.gci.boot.annotation.repeat.TableRepeat;
import com.gci.boot.common.config.CancelConverter;
import com.gci.boot.common.dict.annotation.Dict;
import com.gci.boot.common.validated.SaveValidated;
import com.gci.boot.common.validated.UpdateValidated;
import com.gci.boot.modules.vehicles.vo.AttachmentDetailVO;
import com.gci.boot.modules.vehicles.vo.RepairDetailVO;
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.Range;
import org.springframework.format.annotation.DateTimeFormat;

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

@Data
@TableName("tb_upkeep_offer")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "保养报价表", description = "保养报价表")
@TableRepeat(aClass = TbUpkeepOffer.class,groups = {SaveValidated.class, UpdateValidated.class})
public class TbUpkeepOffer implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty("主键id")
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @NotBlank(message = "id不能为空！",groups = {UpdateValidated.class})
    @ExcelIgnore
    private String id;

    @ApiModelProperty("关联保养台账id")
    private String upkeepBillId;

    @ApiModelProperty("维修厂")
    @Dict(dicCode = "id",dictTable = "tb_repair_shop_archives",dicText = "name")
    private String repairShop;

    @ApiModelProperty("保养明细")
    private String upkeepDetailJson;
    @ApiModelProperty("保养明细---对象数组")
    @TableField(exist = false)
    private List<RepairDetailVO> repairDetailList;

    @ApiModelProperty("总计")
    private Double totaCost;

    @ApiModelProperty("总计工时")
    private Double totalWorkHours;

    @ApiModelProperty("工时费用总计")
    private Double totalWorkHoursCost;

    @ApiModelProperty("总计材料费")
    private Double materialCost;

    @ApiModelProperty("内容说明")
    private String offerContent;

    @ApiModelProperty("保养前图片")
    private String beforeUpkeepImgUrl;

    @ApiModelProperty("保养中图片")
    private String inUpkeepImgUrl;

    @ApiModelProperty("保养后图片")
    private String afterUpkeepImgUrl;

    @ApiModelProperty("单据附件JSON")
    private String attachmentJson;

    @ApiModelProperty("单据附件列表")
    @TableField(exist = false)
    private List<AttachmentDetailVO> attachmentUpkeepList;


    /**所属机构*/
    @ApiModelProperty(value = "所属部门")
    @ExcelIgnore
    private String sysOrgCode;
    /**创建日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "创建日期")
    @ExcelIgnore
    private Date createTime;
    /**更新日期*/
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ApiModelProperty(value = "更新日期")
    @ExcelIgnore
    private Date updateTime;
    /**创建人*/
    @ApiModelProperty(value = "创建人")
    @ExcelIgnore
    private String createBy;
    /**更新人*/
    @ApiModelProperty(value = "更新人")
    @ExcelIgnore
    private String updateBy;
    /**作废标志--默认0-正常，1-作废*/
    @ApiModelProperty(value = "作废标志")
    @ExcelProperty(value = "数据状态", converter = CancelConverter.class)
    @ColumnWidth(value = 15)
    private Integer cancelFlag;
}
