package com.ai.trackwalker.service;

import org.junit.jupiter.api.Test;

import java.util.Map;

import static org.assertj.core.api.Assertions.assertThat;

class RuleEngineTest {
    private final RuleEngine ruleEngine = new RuleEngine();

    @Test
    void createsAlarmForTowerCraneWithin100Meters() {
        RuleDecision decision = ruleEngine.evaluate(
                Map.of(
                        "scene", "塔吊",
                        "category", "塔吊",
                        "confidence", 0.91,
                        "measurements", Map.of("distance_to_track_m", 83.2)
                ),
                Map.of("line_id", "line-001")
        );

        assertThat(decision.decision()).isEqualTo("create_alarm");
        assertThat(decision.severity()).isEqualTo("high");
        assertThat(decision.ruleHits()).contains("线路100米范围内");
    }
}
