package com.mvc.model;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.mvc.constant.OperationStatus;
import com.mvc.entity.TAiread;
import com.mvc.model.biz.TMaintenanceRecordsV2Model;
import org.springframework.format.annotation.DateTimeFormat;

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

/**
 * @Description: 站点投运表
 * @Author: guozhao
 * @CreateDate: 2025-02-26 15:12:18
 */
public class TDeviceOperationModel extends ReqPageGeeker implements Serializable {
    public TDeviceOperationModel() {
    }

    /**
     * 根据维护记录构造对象
     *
     * @param model
     */
    public TDeviceOperationModel(TMaintenanceRecordsV2Model model) {
        this.stationCode = model.getStationCode();
        this.deviceSn = model.getNewDeviceSn();
        this.dataType = "0";
        this.taskStatus = OperationStatus.INSTALLED.getFlag();
        this.maintenanceRecordsId = model.getId();
        this.processingFlag = 0;
    }

    /**
     * 根据读数记录构造对象
     * @param airead
     */
    public TDeviceOperationModel(TAiread airead) {
        this.stationCode = airead.getStationCode();
        this.deviceSn = airead.getDeviceSn();
        this.dataType = "1";
        this.taskStatus = OperationStatus.CONFIG_INVALID.getFlag();
        this.processingFlag = 0;
    }

    /**
     * 主键
     */
    private Integer id;

    /**
     * 遥测站点
     */
    private String stationCode;

    /**
     * 设备SN
     */
    private String deviceSn;

    /**
     * 数据类型(0新装,1故障)
     */
    private String dataType;

    /**
     * 运维记录V2表ID(新装时有值)
     */
    private Integer maintenanceRecordsId;

    /**
     * 创建时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh")
    private Date createTime;

    /**
     * 任务状态(0初始,1已配置,2已投运,3已更换或取消)
     * 注意:此字段对设备状态和记录的处理状态有点混淆,不再使用 2025-05-29
     */
    private String taskStatus;

    /**
     * 远程配置表主键
     */
    private Integer remoteCfgId;

    /**
     * 配置人
     */
    private String configMan;

    /**
     * 配置时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh")
    private Date configTime;

    /**
     * 操作(投运)人
     */
    private String operationMan;

    /**
     * 操作(投运)时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8", locale = "zh")
    private Date operationTime;

    /**
     * 处理标记(0:未处理,1:已处理,2:已阅)
     */
    private Integer processingFlag;

    /**
     * 配置任务对象
     */
    private TaskRemoteCfgModel remoteCfgModel;

    /**
     * 配置任务状态
     */
    private String configTaskStatus;

    /**
     * 查询时间范围(配置前端使用)
     */
    private String[] queryTimeRange;

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getStationCode() {
        return stationCode;
    }

    public void setStationCode(String stationCode) {
        this.stationCode = stationCode == null ? null : stationCode.trim();
    }

    public String getDeviceSn() {
        return deviceSn;
    }

    public void setDeviceSn(String deviceSn) {
        this.deviceSn = deviceSn == null ? null : deviceSn.trim();
    }

    public String getDataType() {
        return dataType;
    }

    public void setDataType(String dataType) {
        this.dataType = dataType == null ? null : dataType.trim();
    }

    public Integer getMaintenanceRecordsId() {
        return maintenanceRecordsId;
    }

    public void setMaintenanceRecordsId(Integer maintenanceRecordsId) {
        this.maintenanceRecordsId = maintenanceRecordsId;
    }

    public Date getCreateTime() {
        return createTime;
    }

    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }

    public String getTaskStatus() {
        return taskStatus;
    }

    public void setTaskStatus(String taskStatus) {
        this.taskStatus = taskStatus == null ? null : taskStatus.trim();
    }

    public Integer getRemoteCfgId() {
        return remoteCfgId;
    }

    public void setRemoteCfgId(Integer remoteCfgId) {
        this.remoteCfgId = remoteCfgId;
    }

    public String getConfigMan() {
        return configMan;
    }

    public void setConfigMan(String configMan) {
        this.configMan = configMan == null ? null : configMan.trim();
    }

    public Date getConfigTime() {
        return configTime;
    }

    public void setConfigTime(Date configTime) {
        this.configTime = configTime;
    }

    public String getOperationMan() {
        return operationMan;
    }

    public void setOperationMan(String operationMan) {
        this.operationMan = operationMan == null ? null : operationMan.trim();
    }

    public Date getOperationTime() {
        return operationTime;
    }

    public void setOperationTime(Date operationTime) {
        this.operationTime = operationTime;
    }

    public Integer getProcessingFlag() {
        return processingFlag;
    }

    public void setProcessingFlag(Integer processingFlag) {
        this.processingFlag = processingFlag;
    }

    public TaskRemoteCfgModel getRemoteCfgModel() {
        return remoteCfgModel;
    }

    public void setRemoteCfgModel(TaskRemoteCfgModel remoteCfgModel) {
        this.remoteCfgModel = remoteCfgModel;
    }

    public String getConfigTaskStatus() {
        return configTaskStatus;
    }

    public void setConfigTaskStatus(String configTaskStatus) {
        this.configTaskStatus = configTaskStatus;
    }

    public String[] getQueryTimeRange() {
        return queryTimeRange;
    }

    public void setQueryTimeRange(String[] queryTimeRange) {
        this.queryTimeRange = queryTimeRange;
    }
}