package com.jeesharp.business.modules.setting.dto;

import com.jeesharp.framework.pojo.dto.BaseSaveDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Max;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Size;
import lombok.Data;
import lombok.EqualsAndHashCode;

import java.time.LocalDateTime;

/**
 * 开屏广告保存 DTO，用于后台新增/编辑。
 *
 * @author jeesharp
 * @since 2026-04-21
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "开屏广告保存请求")
public class AppSplashAdSaveDTO extends BaseSaveDTO {

    @NotBlank(message = "端类型不能为空")
    @Schema(description = "端：WECHAT_MINI/APP/H5", requiredMode = Schema.RequiredMode.REQUIRED)
    private String platform;

    @NotNull(message = "媒体类型不能为空")
    @Schema(description = "媒体类型：1-图片 2-视频", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer mediaType;

    @NotBlank(message = "资源地址不能为空")
    @Size(max = 1000, message = "资源地址过长")
    @Schema(description = "图片或视频 URL", requiredMode = Schema.RequiredMode.REQUIRED)
    private String mediaUrl;

    @Size(max = 1000, message = "封面地址过长")
    @Schema(description = "视频封面图 URL")
    private String posterUrl;

    @Size(max = 200, message = "标题过长")
    @Schema(description = "叠字标题")
    private String title;

    @Size(max = 500, message = "副标题过长")
    @Schema(description = "叠字副标题")
    private String subtitle;

    @Size(max = 1000, message = "链接过长")
    @Schema(description = "点击跳转链接")
    private String linkUrl;

    @NotNull(message = "倒计时时长不能为空")
    @Min(value = 1, message = "倒计时时长至少 1 秒")
    @Max(value = 60, message = "倒计时时长不超过 60 秒")
    @Schema(description = "停留倒计时秒数", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer durationSec;

    @NotNull(message = "是否可跳过不能为空")
    @Schema(description = "是否可跳过：0-否 1-是", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer skippable;

    @Schema(description = "展示开始时间，空不限制")
    private LocalDateTime displayBegin;

    @Schema(description = "展示结束时间，空不限制")
    private LocalDateTime displayEnd;

    @Schema(description = "排序号")
    private Integer sortOrder;

    @Schema(description = "状态：0-禁用 1-启用")
    private Integer status;
}
