package com.dora.dto;

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

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

/**
 * 订单相关DTO
 */
public class OrderDto {

    /**
     * 订单列表项
     */
    @Data
    @Schema(description = "订单列表项")
    public static class OrderListItem {
        @Schema(description = "订单ID", example = "1")
        private Long id;
        
        @Schema(description = "订单号", example = "ORD202412010001")
        private String orderNo;
        
        @Schema(description = "套餐名称", example = "月度VIP")
        private String planName;
        
        @Schema(description = "订单金额", example = "29.99")
        private BigDecimal amount;
        
        @Schema(description = "订单状态", example = "1")
        private Integer status;
        
        @Schema(description = "订单状态描述", example = "已完成")
        private String statusText;
        
        @Schema(description = "支付方式", example = "1")
        private Integer paymentMethod;
        
        @Schema(description = "支付方式描述", example = "支付宝")
        private String paymentMethodText;
        
        @Schema(description = "创建时间", example = "2024-12-01T10:00:00")
        private LocalDateTime createTime;
        
        @Schema(description = "支付时间", example = "2024-12-01T10:05:00")
        private LocalDateTime paidAt;
    }

    /**
     * 订单详情
     */
    @Data
    @Schema(description = "订单详情")
    public static class OrderDetail {
        @Schema(description = "订单ID", example = "1")
        private Long id;
        
        @Schema(description = "订单号", example = "ORD202412010001")
        private String orderNo;
        
        @Schema(description = "套餐ID", example = "1")
        private Long planId;
        
        @Schema(description = "套餐名称", example = "月度VIP")
        private String planName;
        
        @Schema(description = "套餐描述", example = "享受VIP特权30天")
        private String planDescription;
        
        @Schema(description = "套餐价格", example = "29.99")
        private BigDecimal planPrice;
        
        @Schema(description = "有效期天数", example = "30")
        private Integer durationDays;
        
        @Schema(description = "目标角色等级", example = "2")
        private Integer targetRole;
        
        @Schema(description = "订单金额", example = "29.99")
        private BigDecimal amount;
        
        @Schema(description = "订单状态", example = "1")
        private Integer status;
        
        @Schema(description = "订单状态描述", example = "已完成")
        private String statusText;
        
        @Schema(description = "支付方式", example = "1")
        private Integer paymentMethod;
        
        @Schema(description = "支付方式描述", example = "支付宝")
        private String paymentMethodText;
        
        @Schema(description = "创建时间", example = "2024-12-01T10:00:00")
        private LocalDateTime createTime;
        
        @Schema(description = "支付时间", example = "2024-12-01T10:05:00")
        private LocalDateTime paidAt;
        
        @Schema(description = "更新时间", example = "2024-12-01T10:05:00")
        private LocalDateTime updateTime;
    }

    /**
     * 订单列表响应
     */
    @Data
    @Schema(description = "订单列表响应")
    public static class OrderListResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "获取成功")
        private String message;
        
        @Schema(description = "订单列表")
        private List<OrderListItem> records;
        
        @Schema(description = "总数量", example = "10")
        private Integer total;
        
        @Schema(description = "当前页码", example = "1")
        private Integer page;
        
        @Schema(description = "每页大小", example = "10")
        private Integer size;
    }

    /**
     * 订单详情响应
     */
    @Data
    @Schema(description = "订单详情响应")
    public static class OrderDetailResponse {
        @Schema(description = "是否成功", example = "true")
        private Boolean success;
        
        @Schema(description = "消息", example = "获取成功")
        private String message;
        
        @Schema(description = "订单详情")
        private OrderDetail order;
    }
} 