package com.tuoheng.admin.entity.domain;

import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.tuoheng.admin.enums.MarkTypeEnum;
import com.tuoheng.admin.enums.UpdateOrCreateEnum;
import com.tuoheng.common.common.BaseEntity;
import com.tuoheng.system.utils.ShiroUtils;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;

import java.io.Serializable;
import java.util.Date;

/**
 * 巡检报告表
 *
 * @author WangHaoran
 * @since 2021-09-29
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("th_report")
public class Report extends BaseEntity implements Serializable {

    private static final long serialVersionUID = 1L;

    public Report(int type){
        if(type== UpdateOrCreateEnum.CREATE.getCode()){
            setCreateUser(ShiroUtils.getUserId());
            setCreateTime(new Date());
            setMark(MarkTypeEnum.VALID.getCode());
        }
        setUpdateUser(ShiroUtils.getUserId());
        setUpdateTime(new Date());
    }

    /**
     * 报告编号
     */
    private String reportNo;

    /**
     * 任务Id
     */
    private Integer missionId;

    /**
     * 生成时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date generateTime;

    /**
     * 任务名称
     */
    private String missionName;

    /**
     * 巡检机场
     */
    private Integer airportId;

    /**
     * 巡检机场名称
     */
    private String airportName;


    /**
     * 巡检方式  1 机场服务，2 人工巡检
     */
    private Integer inspectionType;


    /**
     * 任务类型 1 日常，2 应急巡检
     */
    private Integer type;

    /**
     * 巡检时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date executionStartTime;

    /**
     * 租户id
     */
    private Integer tenantId;

    /**
     * 天气信息
     */
    private String weather;
}
