package com.multictrl.modules.business.q20.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.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.Instant;

/**
 * Q20设备负载数据 InfluxDB记录
 *
 * @author 938693313@qq.com
 * @since 1.0.0 2026/5/12
 */
@AllArgsConstructor
@NoArgsConstructor
@Builder
@Data
@Schema(name = "Q20设备负载上报数据")
@Measurement(name = "q20_mount")
public class Q20MountReport {

    @Schema(description = "设备SN")
    @Column(tag = true)
    private String deviceSn;

    @Schema(description = "架次号")
    @Column(tag = true)
    private String order_id;

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

    @Schema(description = "负载ID")
    @Column
    private String mount_id;

    @Schema(description = "负载挂载口")
    @Column
    private Integer mount_port;

    @Schema(description = "负载类型：ZT30/Z40T/A30/GL60P/4C/SZY/YKX/EayLoad10/LC/PARACHUTE等")
    @Column
    private String mount_type;

    @Schema(description = "云台偏航角，单位°")
    @Column
    private Float payload_yaw;

    @Schema(description = "云台俯仰角，单位°")
    @Column
    private Float payload_pitch;

    @Schema(description = "云台横滚角，单位°")
    @Column
    private Float payload_roll;

    @Schema(description = "云台模式")
    @Column
    private Integer payload_mode;

    @Schema(description = "变焦倍数")
    @Column
    private Float payload_zoom;

    private String timeStr;

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