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

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotNull;
import java.time.LocalDate;
import java.util.List;

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

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

    @Schema(description = "id（修改时必传）", example = "1")
    private Long id;

    @Schema(description = "业务类型：IN/OUT/IN_RETURN/OUT_RETURN", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "bizType不能为空")
    private String bizType;

    @Schema(description = "单据状态", example = "1")
    private Integer status;

    @Schema(description = "单据日期", requiredMode = Schema.RequiredMode.REQUIRED)
    @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY)
    @NotNull(message = "orderDate不能为空")
    private LocalDate orderDate;

    // 入库头
    @Schema(description = "入库来源")
    private String inSource;

    @Schema(description = "关联原入库单ID（bizType=IN_RETURN 时必填）")
    private Long sourceInboundOrderId;

    @Schema(description = "入库原因")
    private String inReason;

    // 出库头
    @Schema(description = "领用部门ID", example = "100")
    private Long outDeptId;

    @Schema(description = "关联原出库单ID（bizType=OUT_RETURN 时必填）")
    private Long sourceOutboundOrderId;

    @Schema(description = "领用人")
    private String outUser;

    @Schema(description = "出库原因")
    private String outReason;

    @Schema(description = "单据号（导入场景可指定）")
    private String orderNo;

    @Schema(description = "备注")
    private String remark;

    @Schema(description = "退回原因")
    private String returnReason;

    @Schema(description = "租户id", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "tenantId不能为空")
    private Long tenantId;

    @Schema(description = "明细行", requiredMode = Schema.RequiredMode.REQUIRED)
    @NotNull(message = "items不能为空")
    private List<MaterialIoOrderItemSaveReqVO> items;
}
