package com.jeesharp.business.modules.trade.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;

import java.math.BigDecimal;

/**
 * 创建统一交易订单时的明细行入参（内部编排使用）。
 *
 * @author jeesharp
 * @since 2026-05-08
 */
@Data
@Schema(description = "统一交易订单明细创建参数")
public class TradeOrderLineCreateDTO {

    @NotNull(message = "行号不能为空")
    @Min(value = 1, message = "行号至少为1")
    @Schema(description = "行号", requiredMode = Schema.RequiredMode.REQUIRED)
    private Integer lineNo;

    @NotBlank(message = "行标题不能为空")
    @Schema(description = "行标题快照", requiredMode = Schema.RequiredMode.REQUIRED)
    private String itemTitle;

    @Schema(description = "SKU引用")
    private String skuRef;

    @Schema(description = "资源引用")
    private String resourceRef;

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

    @NotNull(message = "单价不能为空")
    @Schema(description = "单价", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal unitPrice;

    @NotNull(message = "行小计不能为空")
    @Schema(description = "行小计", requiredMode = Schema.RequiredMode.REQUIRED)
    private BigDecimal lineAmount;

    @Schema(description = "行快照JSON")
    private String snapshotJson;
}
