package cn.iocoder.foodnexus.module.erp.controller.admin.purchase.vo.supplier;

import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;
import org.springframework.web.multipart.MultipartFile;

import java.util.ArrayList;
import java.util.List;

/**
 * @author : yanghao
 * create at:  2026/1/5  15:12
 * @description:
 */
@Data
@Schema(description = "供应商后台发货")
public class SupplierPurchaseOrderDeliveryReqVO {

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

    @Data
    public static class Item {
        @Schema(description = "id" , requiredMode = Schema.RequiredMode.REQUIRED)
        @NotNull(message = "id不能为空")
        private Long id;

        @Schema(description = "文件附件url")
        private String file;
    }

    public static SupplierPurchaseOrderDeliveryReqVO transform(List<Long> ids) {
        SupplierPurchaseOrderDeliveryReqVO data = new SupplierPurchaseOrderDeliveryReqVO();
        List<Item> items = new ArrayList<>(ids.size());
        for (Long id : ids) {
            Item item = new Item();
            item.setId(id);
            items.add(item);
        }
        data.setItems(items);
        return data;
    }

}
