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

import com.qqchen.deploy.backend.framework.dto.BaseDTO;
import com.qqchen.deploy.backend.notification.entity.config.BaseTemplateConfig;
import com.qqchen.deploy.backend.notification.enums.NotificationChannelTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 通知模板DTO
 *
 * @author qqchen
 * @since 2025-11-12
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "通知模板DTO")
public class NotificationTemplateDTO extends BaseDTO {
    
    @Schema(description = "模板名称", example = "Jenkins构建通知")
    @NotBlank(message = "模板名称不能为空")
    @Size(max = 100, message = "模板名称长度不能超过100个字符")
    private String name;
    
    @Schema(description = "模板编码", example = "jenkins_build_wework")
    @NotBlank(message = "模板编码不能为空")
    @Size(max = 50, message = "模板编码长度不能超过50个字符")
    private String code;
    
    @Schema(description = "模板描述", example = "用于Jenkins构建结果通知的模板")
    @Size(max = 500, message = "模板描述长度不能超过500个字符")
    private String description;
    
    @Schema(description = "渠道类型", example = "WEWORK")
    @NotNull(message = "渠道类型不能为空")
    private NotificationChannelTypeEnum channelType;
    
    @Schema(description = "标题模板（可选）", example = "构建通知 - ${projectName}")
    @Size(max = 200, message = "标题模板长度不能超过200个字符")
    private String titleTemplate;
    
    @Schema(description = "内容模板", example = "### 构建通知\\n**项目**: ${projectName}")
    @NotBlank(message = "内容模板不能为空")
    private String contentTemplate;
    
    @Schema(description = "是否启用", example = "true")
    private Boolean enabled = true;
    
    @Schema(description = "模板配置（根据渠道类型不同而不同）")
    private BaseTemplateConfig templateConfig;
}
