package cloud.nstart.terravault.ordinis.restapi.dto.webhook;

import cloud.nstart.terravault.ordinis.domain.DataScope;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;

import java.util.List;

/**
 * Request на создание/обновление webhook subscription.
 * URL валидируется regex (http/https), фильтры optional.
 */
public record CreateWebhookSubscriptionRequest(
    @NotBlank @Size(max = 128) String name,
    @NotBlank
    @Size(max = 2048)
    @Pattern(regexp = "^https?://.+", message = "URL must start with http:// or https://")
    String url,
    /** NULL/empty = match all scopes. */
    List<DataScope> scopeFilter,
    /** NULL/empty = match all dictionaries. */
    List<String> dictionaryFilter,
    /** NULL/empty = match all event types. */
    List<String> eventTypeFilter,
    Boolean active,
    @Size(max = 1024) String description) {
}
