package com.multictrl.modules.business.influxdb;

import com.fasterxml.jackson.annotation.JsonProperty;
import com.influxdb.annotations.Column;
import com.influxdb.annotations.Measurement;
import com.multictrl.common.utils.DateUtils;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.time.Instant;

/**
 * 飞行日志
 *
 * @author Sdy
 * @since 1.0.0 2026/6/1
 */
@Data
@Schema(name = "飞行日志")
@Measurement(name = "flight_log")
public class FlightLog {

    @Schema(description = "主控sn")
    @Column(tag = true)
    private String dockSn;

    @Schema(hidden = true)
    @Column(timestamp = true)
    @JsonProperty("_time")
    private Instant time;

    @Column
    private String method;

    //{"0":"通知","1":"提醒","2":"警告"}
    @Column
    private Integer level;

    @Column
    private String message;

    /**
     * 时间字符串
     */
    private String timeStr;

    public void setTime(Instant time) {
        this.time = time;
        this.timeStr = DateUtils.utcToTime(time);
    }
}
