package cc.iotkit.data.model;

import cc.iotkit.common.tenant.dao.TenantAware;
import cc.iotkit.common.tenant.listener.TenantListener;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.sun.xml.bind.v2.TODO;
import io.github.linpeilie.annotations.AutoMapper;
import lombok.*;
import org.hibernate.annotations.Filter;
import org.hibernate.annotations.FilterDef;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.ParamDef;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

/**
 * 工单 DO
 *
 * @author zhp
 */
// 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库，可不写。
@Data
@Entity
@Table(name = "t_d_worder")
@AutoMapper(target= cc.iotkit.model.worder.WorderDO.class)
@FilterDef(name = "tenantFilter", parameters = {@ParamDef(name = "tenantId", type = "long")})
@Filter(name = "tenantFilter", condition = "tenant_id = :tenantId")
@EntityListeners(TenantListener.class)
public class TbWorderDO extends BaseEntity implements TenantAware {

    /**
     * ID
     */
    @Id
    @GeneratedValue(generator = "SnowflakeIdGenerator")
    @GenericGenerator(name = "SnowflakeIdGenerator", strategy = "cc.iotkit.data.config.id.SnowflakeIdGenerator")
    private Long id;

    /**
     * 工单编号
     */
    private String worderNum;
    /**
     * 工单内容
     */
    private String worderContent;
    /**
     * 上报时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date reportTime;
    /**
     * 指派人id
     */
    private Long assignUserid;
    /**
     * 指派人姓名
     */
    private String assignName;

    /**
     * 指派人电话
     */
    private String assignPhone;

    /**
     * 指派时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date assignTime;
    /**
     * 问题截图
     */
    private String problemScreenshot;
    /**
     * 消息
     */
    private String message;
    /**
     * 预约时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private String reservationTime;
    /**
     * 客户id
     */
    private Long customerId;
    /**
     * 客户姓名
     */
    private String customerName;
    /**
     * 联系方式
     */
    private String customerPhone;
    /**
     * 客户服务地址编码
     */
    private Integer customerAreaId;
    /**
     * 服务地址(客户详细地址)
     */
    private String customerAddress;
    /**
     * 退单时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date worderBackTime;
    /**
     * 退单原因
     */
    private String worderBackReason;
    /**
     * 工单完成时间
     */
    @JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private Date finishTime;
    /**
     * 完成后图片
     */
    private String finishPicture;
    /**
     * 反馈信息
     */
    private String feedback;

    /**
     * 工单类型
     * <p>
     * 枚举 {@link TODO worder_type 对应的类}
     */
    private Integer worderType;
    /**
     * 订单id
     */
    private String orderId;
    /**
     * 设备id
     */
    private String productId;
    /**
     * 订单状态
     * <p>
     * 枚举 {@link TODO is_state 对应的类}
     */
    private Integer orderStatus;
    /**
     * 工单状态
     * <p>
     * 枚举 {@link TODO worder_status 对应的类}
     */
    private Integer worderStatus;

    /**
     * 滤芯名称
     */
    private Long fwId;



    private Long tenantId;
}