package com.dora.dto;

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

import java.math.BigDecimal;
import java.util.List;

/**
 * 推广规则相关DTO
 */
public class PromotionRuleDto {
    
    private PromotionRuleDto() {
        // 私有构造函数，防止实例化
    }

    /**
     * 推广等级规则
     */
    @Data
    @Schema(description = "推广等级规则")
    public static class PromotionLevelRule {
        @Schema(description = "等级", example = "1")
        private Integer level;
        
        @Schema(description = "等级名称", example = "初级推广员")
        private String levelName;
        
        @Schema(description = "最小粉丝数", example = "10")
        private Integer minFans;
        
        @Schema(description = "提成比例", example = "0.05")
        private BigDecimal commissionRate;
        
        @Schema(description = "等级描述", example = "达到10个付费粉丝即可升级为初级推广员")
        private String description;
    }

    /**
     * 内容收益规则
     */
    @Data
    @Schema(description = "内容收益规则")
    public static class ContentRewardRule {
        @Schema(description = "规则类型", example = "video")
        private String type;
        
        @Schema(description = "类型名称", example = "视频播放")
        private String typeName;
        
        @Schema(description = "目标次数", example = "1000")
        private Integer targetCount;
        
        @Schema(description = "奖励金额", example = "10.00")
        private BigDecimal rewardAmount;
        
        @Schema(description = "配置值", example = "0.01")
        private BigDecimal configValue;
        
        @Schema(description = "规则描述", example = "视频播放1000次奖励10元")
        private String description;
    }

    /**
     * 推广规则响应
     */
    @Data
    @Schema(description = "推广规则响应")
    public static class PromotionRuleResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "获取成功")
        private String message;
        
        @Schema(description = "推广等级规则列表")
        private List<PromotionLevelRule> promotionLevels;
        
        @Schema(description = "内容收益规则列表")
        private List<ContentRewardRule> contentRewards;
        
        @Schema(description = "推广说明", example = "通过推广获得粉丝，粉丝购买会员可获得提成收益")
        private String promotionDescription;
        
        @Schema(description = "收益说明", example = "创作优质内容，获得播放和复制收益")
        private String rewardDescription;
    }

    /**
     * 用户推广状态实时信息
     */
    @Data
    @Schema(description = "用户推广状态实时信息")
    public static class UserPromotionStatus {
        @Schema(description = "用户当前推广等级", example = "2")
        private Integer currentLevel;
        
        @Schema(description = "当前等级名称", example = "初级推广员")
        private String currentLevelName;
        
        @Schema(description = "当前等级提成比例", example = "8.0")
        private BigDecimal currentCommissionRate;
        
        @Schema(description = "当前等级最小粉丝数要求", example = "10")
        private Integer currentLevelMinFans;
        
        @Schema(description = "总粉丝数", example = "25")
        private Integer totalFansCount;
        
        @Schema(description = "付费粉丝数", example = "15")
        private Integer paidFansCount;
        
        @Schema(description = "下一等级", example = "3")
        private Integer nextLevel;
        
        @Schema(description = "下一等级名称", example = "中级推广员")
        private String nextLevelName;
        
        @Schema(description = "下一等级提成比例", example = "12.0")
        private BigDecimal nextCommissionRate;
        
        @Schema(description = "下一等级需要的最小粉丝数", example = "50")
        private Integer nextLevelMinFans;
        
        @Schema(description = "距离下一等级还需要的粉丝数", example = "35")
        private Integer fansToNextLevel;
        
        @Schema(description = "是否已达到最高等级", example = "false")
        private Boolean isMaxLevel;
        
        @Schema(description = "推广等级规则列表（含实时状态）")
        private List<PromotionLevelWithStatus> promotionLevelsWithStatus;
    }
    
    /**
     * 带状态的推广等级规则
     */
    @Data
    @Schema(description = "带状态的推广等级规则")
    public static class PromotionLevelWithStatus {
        @Schema(description = "等级", example = "1")
        private Integer level;
        
        @Schema(description = "等级名称", example = "初级推广员")
        private String levelName;
        
        @Schema(description = "最小粉丝数", example = "10")
        private Integer minFans;
        
        @Schema(description = "提成比例", example = "0.05")
        private BigDecimal commissionRate;
        
        @Schema(description = "等级描述", example = "达到10个付费粉丝即可升级为初级推广员")
        private String description;
        
        @Schema(description = "是否为当前等级", example = "true")
        private Boolean isCurrent;
        
        @Schema(description = "是否已达成", example = "true")
        private Boolean isAchieved;
        
        @Schema(description = "达成进度百分比", example = "75.5")
        private BigDecimal achievementRate;
    }
} 