package com.fuyuanshen.web.service.device.status.base;

import org.springframework.stereotype.Component;

import java.util.LinkedHashMap;
import java.util.List;


@Component
public class RealTimeStatusEngine {
    

    private final LinkedHashMap<String, DeviceStatusRule> rulesMap = new LinkedHashMap<>();
    public RealTimeStatusEngine(List<DeviceStatusRule> rules) {
        rules.forEach(rule -> rulesMap.put(rule.getCommandType(), rule)
        );
    }


    public DeviceStatusRule getDeviceStatusRule(String commandType) {
        return rulesMap.get(commandType);
    }
}
