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 MembershipPlanDto {
    
    // 私有构造函数，防止实例化
    private MembershipPlanDto() {
    }

    /**
     * 套餐信息
     */
    @Data
    @Schema(description = "套餐信息")
    public static class PlanInfo {
        @Schema(description = "套餐ID", example = "1")
        private Long id;
        
        @Schema(description = "套餐名称", example = "月度VIP")
        private String name;
        
        @Schema(description = "套餐描述", example = "享受VIP特权30天")
        private String description;
        
        @Schema(description = "套餐价格", example = "29.99")
        private BigDecimal price;
        
        @Schema(description = "有效期天数", example = "30")
        private Integer durationDays;
        
        @Schema(description = "目标角色等级", example = "2")
        private Integer targetRole;
        
        @Schema(description = "目标角色名称", example = "VIP")
        private String targetRoleName;
        
        @Schema(description = "优惠百分比率", example = "10.50")
        private BigDecimal discountPercentage;
        
        @Schema(description = "优惠后价格", example = "26.99")
        private BigDecimal discountedPrice;
    }

    /**
     * 套餐列表响应
     */
    @Data
    @Schema(description = "套餐列表响应")
    public static class PlanListResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "获取成功")
        private String message;
        
        @Schema(description = "套餐列表")
        private List<PlanInfo> plans;
    }

    /**
     * 购买请求
     */
    @Data
    @Schema(description = "套餐购买请求")
    public static class PurchaseRequest {
        @Schema(description = "套餐ID", example = "1")
        private Long planId;
        
        @Schema(description = "实际支付价格（考虑优惠后）", example = "25.99")
        private BigDecimal actualPrice;
        
        @Schema(description = "实际获得的会员天数", example = "35")
        private Integer actualDurationDays;
        
        @Schema(description = "优惠类型", example = "CONTINUOUS_MONTHLY", allowableValues = {"NONE", "CONTINUOUS_MONTHLY", "CONTINUOUS_YEARLY", "FIRST_PURCHASE", "SPECIAL_OFFER"})
        private String discountType;
        
        @Schema(description = "优惠金额", example = "4.00")
        private BigDecimal discountAmount;
        
        @Schema(description = "优惠描述", example = "连续包月优惠")
        private String discountDescription;
    }

    /**
     * 购买响应
     */
    @Data
    @Schema(description = "套餐购买响应")
    public static class PurchaseResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "订单创建成功")
        private String message;
        
        @Schema(description = "订单号", example = "ORD202412011030001234")
        private String orderNo;
        
        @Schema(description = "订单ID", example = "1")
        private Long orderId;
        
        @Schema(description = "订单金额", example = "29.99")
        private BigDecimal amount;
        
        @Schema(description = "套餐信息")
        private PlanInfo planInfo;
    }
}
