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

import cn.idev.excel.annotation.ExcelIgnoreUnannotated;
import cn.idev.excel.annotation.ExcelProperty;
import cn.iocoder.foodnexus.framework.common.enums.CheckTaskStatus;
import cn.iocoder.foodnexus.module.erp.api.enums.ErpDeliveryStatus;
import cn.iocoder.foodnexus.module.erp.api.vo.warehouse.WarehouseInfo;
import cn.iocoder.foodnexus.module.order.dto.CustomerAddressInfo;
import cn.iocoder.foodnexus.module.order.enums.DeliveryMode;
import cn.iocoder.foodnexus.module.product.api.dto.ProductInfo;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.NotNull;
import lombok.Data;

import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;

@Schema(description = "管理后台 - ERP 采购订单 Response VO")
@Data
@ExcelIgnoreUnannotated
public class ErpPurchaseOrderExportVO {

    @Schema(description = "编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "17386")
    @ExcelProperty("编号")
    private Long id;

    @Schema(description = "采购单编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "XS001")
    @ExcelProperty("采购单编号")
    private String no;

    @Schema(description = "采购状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
    private Integer status;

    @Schema(description = "产品信息", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("产品信息")
    private String productNames;

    @Schema(description = "供应商编号", requiredMode = Schema.RequiredMode.REQUIRED, example = "1724")
    private Long supplierId;
    @Schema(description = "供应商名称", example = "芋道")
    @ExcelProperty("供应商名称")
    private String supplierName;

    @Schema(description = "采购时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("订单时间")
    private LocalDateTime orderTime;

    @Schema(description = "合计数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "15663")
    @ExcelProperty("总数量")
    private BigDecimal totalCount;
    @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
    // @ExcelProperty("金额合计")
    private BigDecimal totalPrice;
    @Schema(description = "应收金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
    // @ExcelProperty("应收金额")
    private Integer depositPrice;

    @Schema(description = "最终合计价格", requiredMode = Schema.RequiredMode.REQUIRED, example = "24906")
    @ExcelProperty("金额合计,单位：元")
    private BigDecimal totalPriceYuan;
    @Schema(description = "应收金额", requiredMode = Schema.RequiredMode.REQUIRED, example = "7127")
    @ExcelProperty("应收金额,单位：元")
    private BigDecimal depositPriceYuan;

    @Schema(description = "采购入库数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
    @ExcelProperty("入库数量")
    private BigDecimal inCount;

    @Schema(description = "采购退货数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "100.00")
    @ExcelProperty("退货数量")
    private BigDecimal returnCount;

    @Schema(description = "备注", example = "你猜")
    @ExcelProperty("备注")
    private String remark;

    @Schema(description = "创建人名称", example = "芋道")
    private String creatorName;

    @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("创建时间")
    private LocalDateTime createTime;

    /**
     * 发货状态
     *
     * 枚举 {@link ErpDeliveryStatus}
     */
    @Schema(description = "发货状态")
    private String deliveryStatus;

    @ExcelProperty("状态")
    private String deliveryStatusStr;

    /**
     * 质检状态
     *
     * 枚举 {@link CheckTaskStatus}
     */
    @Schema(description = "质检状态")
    private String checkTaskStatus;

    @ExcelProperty("质检结果")
    private String checkTaskStatusStr;

    /* ------ 客户订单 ------ */

    @Schema(description = "客户收货地址info")
    private CustomerAddressInfo addressInfo;

    @ExcelProperty("配送地址")
    private String addressInfoStr;

    @Schema(description = "配送仓库info")
    private WarehouseInfo warehouseInfo;

    @ExcelProperty("配送仓库")
    private String warehouseStr;

    @Schema(description = "预计配送开始时间")
    @ExcelProperty("预计配送开始时间")
    private LocalDateTime planDeliveryStartTime;

    @Schema(description = "预计配送结束时间")
    @ExcelProperty("预计配送结束时间")
    private LocalDateTime planDeliveryEndTime;

    @Schema(description = "客户订单编号", requiredMode = Schema.RequiredMode.REQUIRED)
    @ExcelProperty("客户订单编号")
    private String customerOrderCode;

    @Schema(description = "客户id")
    private Long customerId;

    @Schema(description = "客户名称")
    @ExcelProperty("客户名称")
    private String customerName;

    @Schema(description = "灶点id")
    private Long customerDeptId;

    @Schema(description = "灶点名称")
    @ExcelProperty("灶点名称")
    private String customerDeptName;

    @Schema(description = "配送模式")
    private DeliveryMode deliveryMode;

    @ExcelProperty("配送模式")
    private String deliveryModeStr;

}
