package com.jeesharp.business.modules.mall.vo;

import com.jeesharp.business.modules.mall.entity.MallOrderItem;
import com.jeesharp.business.modules.mall.dto.MallOrderSubmitLineDTO;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

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

/**
 * 商城结算定价结果（试算/下单共用）。
 *
 * @author jeesharp
 * @since 2026-06-10
 */
@Data
@Schema(description = "商城结算定价结果")
public class MallCheckoutPricingResultVO {

    @Schema(description = "商品金额合计")
    private BigDecimal goodsAmount;

    @Schema(description = "运费合计")
    private BigDecimal freightAmount;

    @Schema(description = "优惠前总额（商品+运费）")
    private BigDecimal totalAmount;

    @Schema(description = "首单立减")
    private BigDecimal firstOrderDiscountAmount;

    @Schema(description = "商户券抵扣合计")
    private BigDecimal merchantCouponAmount;

    @Schema(description = "平台券抵扣合计")
    private BigDecimal platformCouponAmount;

    @Schema(description = "优惠券抵扣合计")
    private BigDecimal couponAmount;

    @Schema(description = "应付总额")
    private BigDecimal payAmount;

    @Schema(description = "按商户明细")
    private List<MallFreightMerchantBreakdownVO> merchantBreakdown = new ArrayList<>();

    @Schema(description = "按商户拆单定价行（内部落单用）")
    private List<TenantPricingLine> tenantLines = new ArrayList<>();

    /**
     * 单租户拆单定价行。
     */
    @Data
    public static class TenantPricingLine {

        private String tenantKey;
        private String tenantCode;
        private String tenantId;
        private BigDecimal goodsAmount;
        private BigDecimal freightAmount;
        private BigDecimal merchantCouponAmount;
        private BigDecimal firstOrderDiscountAmount;
        private BigDecimal platformCouponAmount;
        private BigDecimal payAmount;
        private String merchantMemberCouponId;
        private List<MallOrderSubmitLineDTO> lineDtos = new ArrayList<>();
        private List<MallOrderItem> lines = new ArrayList<>();
    }
}
