package dto

import (
	"time"

	"git.huangwc.com/pig/pig-farm-controller/internal/infra/models"

	"go.uber.org/zap/zapcore"
)

// SendTestNotificationRequest 定义了发送测试通知请求的 JSON 结构
type SendTestNotificationRequest struct {
	// Type 指定要测试的通知渠道
	Type models.NotifierType `json:"type" validate:"required"`
}

// ListNotificationRequest 定义了获取通知列表的请求参数
type ListNotificationRequest struct {
	Page         int                        `json:"page" query:"page"`
	PageSize     int                        `json:"page_size" query:"page_size"`
	UserID       *uint32                    `json:"user_id" query:"user_id"`
	NotifierType *models.NotifierType       `json:"notifier_type" query:"notifier_type"`
	Status       *models.NotificationStatus `json:"status" query:"status"`
	Level        *zapcore.Level             `json:"level" query:"level"`
	StartTime    *time.Time                 `json:"start_time" query:"start_time"`
	EndTime      *time.Time                 `json:"end_time" query:"end_time"`
	OrderBy      string                     `json:"order_by" query:"order_by"`
}

// NotificationDTO 是用于API响应的通知结构
type NotificationDTO struct {
	ID             uint32                    `json:"id"`
	CreatedAt      time.Time                 `json:"created_at"`
	UpdatedAt      time.Time                 `json:"updated_at"`
	NotifierType   models.NotifierType       `json:"notifier_type"`
	UserID         uint32                    `json:"user_id"`
	Title          string                    `json:"title"`
	Message        string                    `json:"message"`
	Level          models.SeverityLevel      `json:"level"`
	AlarmTimestamp time.Time                 `json:"alarm_timestamp"`
	ToAddress      string                    `json:"to_address"`
	Status         models.NotificationStatus `json:"status"`
	ErrorMessage   string                    `json:"error_message"`
}

// ListNotificationResponse 是获取通知列表的响应结构
type ListNotificationResponse struct {
	List       []NotificationDTO `json:"list"`
	Pagination PaginationDTO     `json:"pagination"`
}
