package com.qqchen.deploy.backend.notification.dto;

import com.fasterxml.jackson.annotation.JsonSubTypes;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.qqchen.deploy.backend.notification.enums.NotificationChannelTypeEnum;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 发送通知请求基类
 * 不同渠道有不同的发送参数，使用多态设计
 *
 * @author qqchen
 * @since 2025-11-12
 */
@Data
@JsonTypeInfo(
    use = JsonTypeInfo.Id.NAME,
    include = JsonTypeInfo.As.PROPERTY,
    property = "channelType"
)
@JsonSubTypes({
    @JsonSubTypes.Type(value = WeworkSendNotificationRequest.class, name = "WEWORK"),
    @JsonSubTypes.Type(value = EmailSendNotificationRequest.class, name = "EMAIL")
})
public abstract class BaseSendNotificationRequest {
    
    /**
     * 消息内容（必填）
     */
    @NotBlank(message = "消息内容不能为空")
    private String content;

    /**
     * 消息标题（可选，由模板解析后设置）
     */
    private String title;
    
    /**
     * 获取渠道类型
     */
    public abstract NotificationChannelTypeEnum getChannelType();
}
