package webhook

import "time"

// AlertmanagerPayload is the webhook payload from Alertmanager.
// See: https://prometheus.io/docs/alerting/latest/configuration/#webhook_config
type AlertmanagerPayload struct {
	Version            string              `json:"version"`
	GroupKey           string              `json:"groupKey"`
	TruncatedAlerts    int                 `json:"truncatedAlerts"`
	Status             string              `json:"status"` // firing / resolved
	Receiver           string              `json:"receiver"`
	GroupLabels        map[string]string   `json:"groupLabels"`
	CommonLabels       map[string]string   `json:"commonLabels"`
	CommonAnnotations  map[string]string   `json:"commonAnnotations"`
	ExternalURL        string              `json:"externalURL"`
	NotificationReason string              `json:"notification_reason"`
	Alerts             []AlertmanagerAlert `json:"alerts"`
}

type AlertmanagerAlert struct {
	Status       string            `json:"status"` // firing / resolved
	Labels       map[string]string `json:"labels"`
	Annotations  map[string]string `json:"annotations"`
	StartsAt     time.Time         `json:"startsAt"`
	EndsAt       time.Time         `json:"endsAt"`
	GeneratorURL string            `json:"generatorURL"`
	Fingerprint  string            `json:"fingerprint"`
}
