package com.cameleer.server.app.alerting.dto;

import com.cameleer.server.core.alerting.AlertCondition;
import com.cameleer.server.core.alerting.AlertRuleTarget;
import com.cameleer.server.core.alerting.AlertSeverity;
import com.cameleer.server.core.alerting.ConditionKind;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;

import java.util.List;
import java.util.UUID;

public record AlertRuleRequest(
        @NotBlank String name,
        String description,
        @NotNull AlertSeverity severity,
        @NotNull ConditionKind conditionKind,
        @NotNull @Valid AlertCondition condition,
        Integer evaluationIntervalSeconds,
        Integer forDurationSeconds,
        Integer reNotifyMinutes,
        String notificationTitleTmpl,
        String notificationMessageTmpl,
        List<WebhookBindingRequest> webhooks,
        List<AlertRuleTarget> targets
) {
    public AlertRuleRequest {
        webhooks = webhooks == null ? List.of() : List.copyOf(webhooks);
        targets  = targets  == null ? List.of() : List.copyOf(targets);
    }
}
