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 io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
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_assign")
@Accessors(chain = true)
@EqualsAndHashCode(callSuper = false)
@ApiModel(value = "维修指派信息表", description = "维修指派信息表")
@TableRepeat(aClass = TbRepairAssign.class,groups = {SaveValidated.class, UpdateValidated.class})
public class TbRepairAssign 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("维修厂")
    @NotBlank(message = "维修厂不能为空！",groups = {SaveValidated.class,UpdateValidated.class})
    @Dict(dicCode = "id",dictTable = "tb_repair_shop_archives",dicText = "name")
    private String repairShop;

    @ApiModelProperty("联系人")
    private String contact;

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

    @ApiModelProperty("是否维修质保(0-否，1-是)")
    @Dict(dicCode = "yes_no")
    private String isGuarantee;

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

    /**
     * 维修厂名称
     */
    @TableField(exist = false)
    @ExcelIgnore
    private String repairShopName;
}
