package com.ruoyi.dj.mqtt.domain;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import lombok.Data;
import java.util.List;

@Data
@JsonIgnoreProperties(ignoreUnknown = true)
public class OSDMessage1 {
    private String tid;
    private String bid;
    private long timestamp;

    private DataField data;

    @Data
    @JsonIgnoreProperties(ignoreUnknown = true)
    public static class DataField {
        private int job_number;  // 作业次数
        private int acc_time;  // 累计运行时长
        private int activation_time;  // 激活时间

        private MaintainStatus maintain_status;  // 保养状态
        private int electric_supply_voltage;  // 市电电压
        private int working_voltage;  // 工作电压
        private int working_current;  // 工作电流

        private BackupBattery backup_battery;  // 备用电池信息
        private DroneBatteryMaintenanceInfo drone_battery_maintenance_info;  // 飞行器电池保养信息

        @Data
        public static class MaintainStatus {
            private List<MaintainStatusArray> maintain_status_array;  // 保养状态数组

            @Data
            public static class MaintainStatusArray {
                private int state;  // 保养状态
                private int last_maintain_type;  // 上一次保养类型
                private long last_maintain_time;  // 上一次保养时间
                private int last_maintain_work_sorties;  // 上一次保养时作业架次
            }
        }

        @Data
        public static class BackupBattery {
            private int voltage;  // 备用电池电压
            private float temperature;  // 备用电池温度
            @JsonAlias("switch")
            private int switchState;  // 备用电池开关状态
        }

        @Data
        public static class DroneBatteryMaintenanceInfo {
            private int maintenance_state;  // 电池保养状态
            private int maintenance_time_left;  // 电池保养剩余时间
            private int heat_state;  // 电池加热状态
            private List<BatteryDetail> batteries;  // 电池详细信息

            @Data
            public static class BatteryDetail {
                private int index;  // 电池序号
                private int capacity_percent;  // 电池剩余电量
                private int voltage;  // 电池电压
                private float temperature;  // 电池温度
            }
        }
    }
}
