package vip.xiaonuo.coldchain.modular.app.param;

/**
 * @author jackzhou
 * @version 1.0
 * @project jfcloud-coldchain
 * @description
 * @date 2024/11/17 22:30:15
 */

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import vip.xiaonuo.coldchain.core.service.dataprocess.model.PowerEnum;
import vip.xiaonuo.coldchain.modular.monitortarget.entity.MonitorTarget;

import java.util.ArrayList;
import java.util.List;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class AppDevice extends MonitorTarget {
    /**
     * 是否插电
     *
     * @return
     */
    @Schema(description = "AC电源 DC电池")
    private String plugInStatus = PowerEnum.AC.getCode();

    /**
     * 电池电量 (%)
     */
    @Schema(description = "电池电量 (%)")
    @JsonSerialize(using = FloatNullToDashSerializer.class)  // 使用自定义序列化器
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "#.00")
    private Float batteryPercentage;

    /**
     * 关键的设备探头集合
     *
     * @return
     */
    @Schema(description = "关键的设备探头集合")
    private List<AppDeviceData> children = new ArrayList<AppDeviceData>();

}
