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.Length;
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_repair_offer")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "维修报价表", description = "维修报价表")
@TableRepeat(aClass = TbRepairOffer.class,groups = {SaveValidated.class, UpdateValidated.class})
public class TbRepairOffer 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 repairId;

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

    @ApiModelProperty("维修明细")
    private String repairDetailJson;

    @ApiModelProperty("维修明细---对象数组")
    @TableField(exist = false)
    private List<RepairDetailVO> repairDetailList;

    @ApiModelProperty("总计工时")
    @NotBlank(message = "总计工时不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Range(min = 0, max = 99999999, message = "总计工时在[0,99999999]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    private Double totalWorkHours;

    @ApiModelProperty("工时费用总计")
    @NotBlank(message = "工时费用总计不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Range(min = 0, max = 99999999, message = "工时费用总计在[0,99999999]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    private Double totalWorkHoursCost;

    @ApiModelProperty("联维修报价")
    @NotBlank(message = "联维修报价不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Range(min = 0, max = 99999999, message = "联维修报价在[0,99999999]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    private Double repairCost;

    @ApiModelProperty("总计材料费")
    @NotBlank(message = "总计材料费不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Range(min = 0, max = 99999999, message = "联维修报价在[0,99999999]之间!",groups = {SaveValidated.class,UpdateValidated.class})
    private Double materialCost;

    @ApiModelProperty("内容说明")
    @NotBlank(message = "内容说明不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Length(max = 100,message = "报修内容长度不能超过100位",groups = {SaveValidated.class,UpdateValidated.class})
    private String content;

    @ApiModelProperty("维修中图片")
    private String inRepairImgUrl;

    @ApiModelProperty("维修后图片")
    private String afterRepairImgUrl;

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

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


    /**所属机构*/
    @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;
}
