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.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gci.boot.annotation.Query.SelectQuery;
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 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.springframework.format.annotation.DateTimeFormat;

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

@Data
@TableName("tb_repair_info")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "维修基础信息表", description = "维修基础信息表")
@TableRepeat(aClass = TbRepairInfo.class,groups = {SaveValidated.class, UpdateValidated.class})
public class TbRepairInfo 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;

    //1待提交 - 2待派单 - 3待报价 - 4待审核报价 - 5待审批报价 - 6维修中 - 7待确认结果 - 8已归档 -9作废
    @ApiModelProperty("流程状态")
    @Dict(dicCode = "repair_status")
    private Integer flowStatus = 1;
    //1运营维保部 - 2维修厂 - 3领导审批 - 4结束
    @ApiModelProperty("流程节点")
    @Dict(dicCode = "repair_node")
    private Integer flowNode;

    @ApiModelProperty("工单号")
    private String orderNo;

    @ApiModelProperty("所属项目")
    @NotBlank(message = "所属项目不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Dict(dicCode = "id",dictTable = "tb_projects",dicText = "project_name")
    private String projectId;

    @ApiModelProperty("项目名称")
    @ExcelIgnore
    private String projectName;

    @ApiModelProperty("车牌号")
    @NotBlank(message = "车牌号不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    private String plateNumber;

    @ApiModelProperty("交车时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    private Date deliveryTime;

    @ApiModelProperty("车架号")
    @Length(max = 32,message = "车架号长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String frameNumber;

    @ApiModelProperty("车辆品牌")
    @Dict(dicCode = "vehicle_brand")
    @Length(max = 32,message = "车辆品牌长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String vehicleBrand;

    @ApiModelProperty("车辆型号")
    @Length(max = 32,message = "车辆型号长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String vehicleModel;

    @ApiModelProperty("车辆种类")
    @Dict(dicCode = "vehicle_type")
    @Length(max = 32,message = "车辆种类长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String vehicleType;

    @ApiModelProperty("VIN码")
    @Length(max = 32,message = "VIN码长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String vinCode;

    @ApiModelProperty("发动机码")
    @Length(max = 32,message = "发动机码长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String engineNumber;

    @ApiModelProperty("报修人")
    @Length(max = 32,message = "报修人长度不能超过32位",groups = {SaveValidated.class,UpdateValidated.class})
    private String repairPeople;

    @ApiModelProperty("联系电话")
//    @Pattern(regexp = "^(?:(?:\\+|00)86)?1\\d{10}$",message = "联系电话格式错误!",groups = {SaveValidated.class,UpdateValidated.class})
    private String phone;

    @ApiModelProperty("报修时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date repairTime;

    @ApiModelProperty("报修分类")
    @NotBlank(message = "报修分类不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Dict(dicCode = "repair_class")
    private String repairClass;

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

    @ApiModelProperty("报修图片")
    private String repairImgUrl;

    @ApiModelProperty("作废意见")
    @Length(max = 200,message = "作废意见长度不能超过200位",groups = {SaveValidated.class,UpdateValidated.class})
    private String cancelIdea;

    @ApiModelProperty("作废人")
    private String cancelPeople;

    @ApiModelProperty("作废时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @ExcelIgnore
    private Date cancelTime;

    @ApiModelProperty("1-数据录入，，2-走流程的")
    @ExcelIgnore
    private Integer addType = 2;

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