package com.storlead.sales.pojo.vo.customer;

import cn.hutool.core.date.DateTime;
import com.alibaba.fastjson.annotation.JSONField;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonRawValue;
import com.storlead.framework.annotate.AnnotateEnumType;
import com.storlead.framework.annotate.Dict;
import com.storlead.framework.annotate.OrgAutoMateAnnotate;
import com.storlead.framework.mybatis.entity.SysBaseField;
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 java.time.LocalDateTime;
import java.util.Date;
import java.util.List;

@Data
@EqualsAndHashCode(callSuper = false)
@Accessors(chain = true)
@ApiModel(value = "WorkOrderDetailVO", description = "工单详情VO")
public class WorkOrderDetailVO extends SysBaseField {
    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "工单主键id")
    private Long id;

    @ApiModelProperty(value = "编码")
    private String dataCode;

    @ApiModelProperty(value = "关联客户ID")
    private Long customerId;

    @ApiModelProperty(value = "联系人ID")
    private Long liaisonId;

    @ApiModelProperty(value = "联系人姓名")
    private Long liaisonName;

    @ApiModelProperty(value = "关联客户名称")
    private String customerName;

    @ApiModelProperty(value = "订单ID")
    private Long orderFormId;

    @ApiModelProperty(value = "工单标题")
    private String title;

    @ApiModelProperty(value = "工单内容")
    private String content;

    @ApiModelProperty(value = "期望完成时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format ="yyyy-MM-dd")
    private Date expectTime;

    @ApiModelProperty(value = "实际完成时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd")
    @DateTimeFormat(pattern="yyyy-MM-dd")
    @JSONField(format ="yyyy-MM-dd")
    private Date actualTime;

//    @ApiModelProperty(value = "提醒用户id，逗号隔开")
    private String remindUserIds;

    @ApiModelProperty(value = "最后处理人id")
    private Long currentUserId;

    @ApiModelProperty(value = "最后处理人")
    private String currentUserName;

    @ApiModelProperty(value = "工单类型id")
    @Dict(dictCode = "work_order_category_id",valueField = "workOrderCategoryName",multiple = true)
    private Integer workOrderCategoryId;

    @ApiModelProperty(value = "工单类型名称")
    private String workOrderCategoryName;

    @ApiModelProperty(value = "工单紧急程度：1:非常紧急，2:紧急，3:一般")
    @Dict(dictCode = "urgent_status",valueField = "urgentStatusName",multiple = true)
    private Integer urgentStatus;

    @ApiModelProperty(value = "工单紧急程度名称")
    private String urgentStatusName;

    @ApiModelProperty(value = "工单的状态：1待处理，2已撤销，3被退回，4已完成，5已确认")
    @Dict(dictCode = "order_status",valueField = "orderStatusName",multiple = true)
    private Integer orderStatus;

    @ApiModelProperty(value = "工单的状态名称")
    private String orderStatusName;

    @ApiModelProperty(value = "订单发起次数")
    private Integer orderCount;

    @ApiModelProperty(value = "退回原因备注")
    private String remark;

    @ApiModelProperty(value = "撤销、拒绝时间")
    @JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    @JSONField(format ="yyyy-MM-dd HH:mm:ss")
    private Date revokeTime;

    @ApiModelProperty(value = "工单来源")
    private String orderFrom;

    @ApiModelProperty(value = "再次发起说明")
    private String orderAgain;

    @ApiModelProperty(value = "归属人员姓名")
    private String ownerByName;


    private String categoryName;

    @JsonRawValue
    private String sysUserId;

    /**
     * 用户名 api传提交申请的人
     */
    private String userName;

//    private String workOrderIds;

    private String fileUrl;
    //项目编码
    private String projectNum;

    // orderType 工单情景 1：撤销工单，2：退回工单，3：完成工单，4：确认不通过工单，5：确认通过工单， 6再次发起工单
    private Integer orderType;

    @ApiModelProperty("指派人的 username,给工单系统查出ID")
    private String assignUsername;

    /**
     * 详情页等待时间
     */
    private String waitTimeStr;

    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @JsonFormat(pattern="yyyy-MM-dd",timezone = "GMT+8")
    private Date showTime;

    @ApiModelProperty(value = "创建人员姓名")
    private String createByName;

    @ApiModelProperty(value = "发起部门id")
    @TableField("create_department_id")
    private Long createDepartmentId;

    @ApiModelProperty(value = "处理部门id")
    @TableField("owner_department_id")
    private Long ownerDepartmentId;

    @ApiModelProperty(value = "发起部门名称")
    @TableField("create_department_name")
    private String createDepartmentName;

    @ApiModelProperty(value = "处理部门名称")
    @TableField("owner_department_name")
    private String ownerDepartmentName;

//    private List<WorkOrderAnnex> annexList;

    @ApiModelProperty(value = "下一个id")
    private Long nextId;

    @ApiModelProperty(value = "上一个id")
    private Long previousId;
}
