package cn.iocoder.yudao.module.system.controller.admin.biz.vo.materialio;

import com.fasterxml.jackson.annotation.JsonAlias;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.time.LocalDate;

import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY;

@Schema(description = "管理后台 - 物资出入库单明细保存 Request VO")
@Data
public class MaterialIoOrderItemSaveReqVO {

    @Schema(description = "物资id(material_info.id)", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "materialId不能为空")
    private Long materialId;

    @Schema(description = "物资编号")
    private String materialNumber;

    @Schema(description = "物资名称")
    private String materialName;

    @Schema(description = "单位")
    private String materialUnit;

    @Schema(description = "关联的入库明细ID (material_inbound_order_item.id)")
    private Long inboundItemId;

    @Schema(description = "关联的出库明细ID (material_outbound_order_item.id)")
    private Long outboundItemId;

    @Schema(description = "关联入库单号（冗余快照，可选）")
    private String refInOrderNo;

    @Schema(description = "入库仓库ID")
    private Long refInStoreId;

    @Schema(description = "数量", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "quantity不能为空")
    private BigDecimal quantity;

    @Schema(description = "入库单价（出库单价=入库单价）")
    private BigDecimal inUnitPrice;

    @Schema(description = "销售单价")
    private BigDecimal saleUnitPrice;

    @Schema(description = "金额")
    private BigDecimal amount;

    @Schema(description = "生产日期")
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @JsonFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    private LocalDate produceDate;
}
