package com.seer.teach.mall.request;

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

import jakarta.validation.Valid;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import java.util.List;

@Data
@Valid
@Schema(name = "OrderSettlementR", description = "商品订单结算Request")
public class OrderSettlementReq {

    @Schema(name = "商品项数组")
    @NotEmpty(message = "商品不能为空")
    private List<Item> items;

    @NotBlank(message = "支付渠道编码不能为空")
    @Schema(name = "支付渠道编码")
    private String channelCode;

    @Data
    @Schema(description = "商品项")
    @Valid
    public static class Item {

        @Schema(name = "商品规格Id")
        @NotNull(message = "商品规格Id不能为空")
        private Integer skuId;

        @Schema(name = "购买数量")
        @Min(value = 1, message = "购买数量最小值为 {value}")
        private Integer count;

        @Schema(name = "购物车的Id")
        private Integer cartId;
    }
}