package com.jeesharp.business.common.appversion.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.util.ArrayList;
import java.util.List;

/**
 * 客户端版本信息 VO，与小程序 {@code VersionInfo} 字段对齐。
 *
 * @author jeesharp
 * @since 2026-05-12
 */
@Data
@Schema(description = "客户端版本信息")
public class AppVersionClientVO {

    @Schema(description = "主键")
    private String id;

    @Schema(description = "版本号展示，如 3.0.2")
    private String version;

    @Schema(description = "整型版本号，用于比较新旧")
    private Integer versionCode;

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

    @Schema(description = "版本类型：1-正式版 2-测试版")
    private Integer versionType;

    @Schema(description = "版本类型名称")
    private String versionTypeName;

    @Schema(description = "更新类型：1-强制更新 2-可选更新")
    private Integer updateType;

    @Schema(description = "更新类型名称")
    private String updateTypeName;

    @Schema(description = "是否为该端当前最新发布版本")
    private Boolean isLatest;

    @Schema(description = "更新说明")
    private UpdateContentVO updateContent = new UpdateContentVO();

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

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

    /**
     * 更新说明分组 VO。
     *
     * @author jeesharp
     * @since 2026-05-12
     */
    @Data
    @Schema(description = "更新说明")
    public static class UpdateContentVO {
        @Schema(description = "新增")
        private List<String> features = new ArrayList<>();
        @Schema(description = "修复")
        private List<String> fixes = new ArrayList<>();
        @Schema(description = "优化")
        private List<String> improvements = new ArrayList<>();
    }
}
