package com.ho.common.tools.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ho.common.tools.constant.CommonConstant;
import com.ho.common.tools.entity.file.OrderFile;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Data
public class OrderForm {

    /**
     * id
     */
    @ApiModelProperty(value = "id",hidden = true)
    private Integer id;


    @ApiModelProperty(value = "集团id",hidden = true)
    private Integer groupId;


    @ApiModelProperty(value = "工单号",hidden = true)
    private String orderNum;
    /**
     * 电站id
     */
    @ApiModelProperty(value = "电站id")
    private Integer stationId;

    @ApiModelProperty(value = "发起人id",hidden = true)
    private String userId;

    @ApiModelProperty(value = "发起人名字")
    private String startUserName;

    //告警id
    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(value = "告警id")
    private Long eventId;


    /**
     * 设备id
     */
    @ApiModelProperty(value = "设备id")
    private Integer deviceId;


    /**
     * 标题
     */
    @ApiModelProperty(value = "标题")
    @Length(max = 50,message = "标题不能超过50个字符")
    private String title;

    /**
     * 备注
     */
    @ApiModelProperty(value = "备注")
    @Length(max = 200,message = "备注不能超过200个字符")
    private String remark;

    /**
     * 备注
     */
    @ApiModelProperty(value = "建议")
    @Length(max = 200,message = "建议不能超过200个字符")
    private String suggestion;

    /**
     * 计划处理时间
     */
    @DateTimeFormat(pattern = CommonConstant.DATE)
    @JsonFormat(pattern = CommonConstant.DATE)
    @ApiModelProperty(value = "计划处理时间")
    private Date plannedTime;

    /**
     * 创建时间
     */
    @ApiModelProperty(value = "创建时间",hidden = true)
    private Date createTime;

    /**
     * 优先级 ,可以从字典定义取值
     */
    @ApiModelProperty(value = "优先级")
    private Integer priority;

    /**
     * 工单类型
     */
    @ApiModelProperty(value = "工单类型 1:故障检修单 2:电站巡检单 3:电站清洗单")
    private Integer orderType;

    @ApiModelProperty(value = "流程id")
    private String processInstanceId;

    @ApiModelProperty(value = "流程key")
    private String processInstanceKey;
    /**
     * 表单状态
     */
    @ApiModelProperty(value = "0:未发起 1:已发起 ")
    private Integer status;

    /**
     * 文件集合
     */
    @ApiModelProperty(value = "文件集合")
    private List<OrderFile> orderFiles = new ArrayList<>();
}
