package com.starry.admin.modules.order.module.dto;

import com.starry.admin.modules.order.module.constant.OrderConstant;
import java.math.BigDecimal;
import java.util.Collections;
import java.util.List;
import lombok.Builder;
import lombok.Data;
import lombok.NonNull;

/**
 * 下单指令，封装不同业务场景需要的参数。
 */
@Data
@Builder
public class OrderPlacementCommand {

    @NonNull
    private final OrderCreationContext orderContext;

    private final String balanceOperationAction;

    @Builder.Default
    private final boolean deductBalance = true;

    private final PricingInput pricingInput;

    /**
     * 计价所需的输入参数。
     */
    @Data
    @Builder
    public static class PricingInput {

        @NonNull
        private final BigDecimal unitPrice;

        private final int quantity;

        @Builder.Default
        private final List<String> couponIds = Collections.emptyList();

        private final String commodityId;

        @NonNull
        private final OrderConstant.PlaceType placeType;
    }
}
