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.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * C 端客户端版本发布保存请求（后台新增/修改）。
 *
 * @author jeesharp
 * @since 2026-05-13
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Schema(description = "客户端版本发布保存请求")
public class ClientAppVersionSaveDTO extends BaseSaveDTO {

    @NotBlank(message = "展示版本号不能为空")
    @Schema(description = "展示版本号，如 3.0.2", requiredMode = Schema.RequiredMode.REQUIRED)
    private String version;

    @NotNull(message = "整型版本号不能为空")
    @Schema(description = "整型版本号，用于比较新旧", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer versionCode;

    @Schema(description = "发布时间展示串")
    private String releaseTime;

    /**
     * 版本类型
     *
     * @see com.jeesharp.business.modules.setting.enums.ClientAppVersionTypeEnum
     */
    @Schema(description = "版本类型：1-正式版 2-测试版")
    private Integer versionType;

    /**
     * 更新策略
     *
     * @see com.jeesharp.business.modules.setting.enums.ClientAppVersionUpdateStrategyEnum
     */
    @Schema(description = "更新策略：1-强制更新 2-可选更新")
    private Integer updateType;

    @NotBlank(message = "适用端 JSON 不能为空")
    @Schema(description = "适用端 JSON 数组，如 [\"MINI\",\"H5\"]；[] 表示全端", requiredMode = Schema.RequiredMode.REQUIRED)
    private String platformsJson;

    @Schema(description = "最低兼容展示版本号")
    private String minVersion;

    @Schema(description = "安装包或商店跳转地址")
    private String downloadUrl;

    @NotBlank(message = "更新说明 JSON 不能为空")
    @Schema(description = "更新说明 JSON：{\"features\":[],\"fixes\":[],\"improvements\":[]}", requiredMode = Schema.RequiredMode.REQUIRED)
    private String updateContentJson;

    /**
     * 发布状态
     *
     * @see com.jeesharp.business.modules.setting.enums.ClientAppVersionStatusEnum
     */
    @Schema(description = "状态：0-草稿 1-已发布 2-已下线")
    private Integer status;
}
