package com.njzscloud.common.localizer;

import com.njzscloud.common.localizer.contant.LocalizerType;
import com.njzscloud.common.localizer.jt808.JT808;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import lombok.extern.slf4j.Slf4j;

@Slf4j
@ToString
@Accessors(chain = true)
public class Localizer {
    /**
     * 设备 Id
     */
    @Getter
    @Setter
    protected String terminalId;

    /**
     * 设备类型
     */
    @Getter
    @Setter
    protected LocalizerType localizerType;
    /**
     * 速度阈值
     */
    @Setter
    private Integer speedThreshold;

    public int getSpeedThreshold() {
        return speedThreshold == null ? 60 : speedThreshold;
    }

    public boolean isOnline() {
        return JT808.isOnline(terminalId);
    }
}
