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

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Min;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

/**
 * 小程序商城下单行：SPU + 数量，可选指定 SKU（未传则取该 SPU 下首个启用 SKU）。
 *
 * @author jeesharp
 * @since 2026-05-15
 */
@Data
@Schema(description = "商城下单商品行")
public class MallOrderSubmitLineDTO {

    @NotBlank(message = "商品SPU不能为空")
    @Schema(description = "SPU 主键", requiredMode = Schema.RequiredMode.REQUIRED)
    private String spuId;

    @Schema(description = "SKU 主键，不传则自动选择启用 SKU")
    private String skuId;

    @NotNull(message = "购买数量不能为空")
    @Min(value = 1, message = "购买数量至少为1")
    @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer quantity;
}
