package com.cameleer.server.core.alerting;

import org.junit.jupiter.api.Test;
import static org.assertj.core.api.Assertions.assertThat;

class AlertScopeTest {

    @Test
    void allFieldsNullIsEnvWide() {
        var s = new AlertScope(null, null, null);
        assertThat(s.isEnvWide()).isTrue();
    }

    @Test
    void appScoped() {
        var s = new AlertScope("orders", null, null);
        assertThat(s.isEnvWide()).isFalse();
        assertThat(s.appSlug()).isEqualTo("orders");
    }

    @Test
    void enumsHaveExpectedValues() {
        assertThat(AlertSeverity.values()).containsExactly(
            AlertSeverity.CRITICAL, AlertSeverity.WARNING, AlertSeverity.INFO);
        assertThat(AlertState.values()).containsExactly(
            AlertState.PENDING, AlertState.FIRING, AlertState.RESOLVED);
        assertThat(ConditionKind.values()).hasSize(7);
        assertThat(TargetKind.values()).containsExactly(
            TargetKind.USER, TargetKind.GROUP, TargetKind.ROLE);
        assertThat(NotificationStatus.values()).containsExactly(
            NotificationStatus.PENDING, NotificationStatus.DELIVERED, NotificationStatus.FAILED);
    }
}
