package com.xunhong.erp.turbo.api.biz.dto.vo;

import com.alibaba.cola.dto.DTO;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.xunhong.erp.turbo.api.biz.dto.common.*;
import com.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderAuditStateEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderPricingMethodEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderStateEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderTypeEnum;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * @author shenyifei
 */
@Data
@Schema(title = "采购订单")
@EqualsAndHashCode(callSuper = true)
@JsonInclude(JsonInclude.Include.NON_NULL)
public class PurchaseOrderVO extends DTO {

	/**
	 * 订单ID
	 */
	@Schema(title = "订单ID", type = "string", requiredMode = Schema.RequiredMode.REQUIRED)
	private Long orderId;

	/**
	 * 订单编号
	 */
	@Schema(title = "订单编号", type = "string", requiredMode = Schema.RequiredMode.REQUIRED)
	private String orderSn;

	/**
	 * 是否是草稿
	 */
	@Schema(title = "是否是草稿", type = "boolean", requiredMode = Schema.RequiredMode.REQUIRED)
	private Boolean draft;

	/**
	 * 步骤标识
	 */
	@Schema(title = "步骤标识", requiredMode = Schema.RequiredMode.REQUIRED)
	private Integer active;

	/**
	 * 产地负责人
	 */
	@Schema(title = "产地负责人")
	private String originPrincipal;

	/**
	 * 工头
	 */
	@Schema(title = "工头")
	private String foreman;

	/**
	 * 报价方式：1_按毛重报价；2_按净重报价；
	 */
	@Schema(title = "报价方式：1_按毛重报价；2_按净重报价；")
	private PurchaseOrderPricingMethodEnum pricingMethod;

	/**
	 * 采购订单状态: 0_草稿；1_审核中；2_已完成；3_已驳回；4_已关闭；
	 */
	@Schema(title = "采购订单状态: 0_草稿；1_审核中；2_已完成；3_已驳回；4_已关闭；")
	private PurchaseOrderStateEnum state;

	/**
	 * 采购单审核状态: 1_待报价审核；2_待老板审批；3_老板审批通过；4_报价审核驳回；5_老板审批驳回
	 */
	@Schema(title = "采购单审核状态: 1_待报价审核；2_待老板审批；3_老板审批通过；4_报价审核驳回；5_老板审批驳回")
	private PurchaseOrderAuditStateEnum auditState;

	/**
	 * 采购类型：1_产地采购；2_市场采购；
	 */
	@Schema(title = "采购类型：1_产地采购；2_市场采购；")
	private PurchaseOrderTypeEnum type;

	/**
	 * 备注
	 */
	@Schema(title = "备注")
	private String remark;

	/**
	 * 创建人ID
	 */
	@Schema(title = "创建人ID", type = "string", requiredMode = Schema.RequiredMode.REQUIRED)
	private Long createdBy;

	/**
	 * 创建人姓名
	 */
	@Schema(title = "创建人姓名")
	private String createdByName;

	/**
	 * 创建时间
	 */
	@Schema(title = "创建时间")
	private LocalDateTime createdAt;

	@Schema(title = "返点信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private OrderRebate orderRebate;

	@Schema(title = "车辆信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private OrderVehicle orderVehicle;

	@Schema(title = "公司信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private OrderCompany orderCompany;

	@Schema(title = "经销商信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private OrderDealer orderDealer;

	@Schema(title = "供应商信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private List<OrderSupplier> orderSupplierList;

	@Schema(title = "采购订单费用信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private List<OrderCost> orderCostList;

	@Schema(title = "采购订单包装箱信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private List<OrderPackage> orderPackageList;

	/**
	 * 项目信息
	 */
	@Schema(title = "采购订单项目信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private List<OrderCostItem> orderCostItemList;

	@Schema(title = "采购订单发货信息", requiredMode = Schema.RequiredMode.REQUIRED)
	private List<OrderShip> orderShipList;

	@SuppressWarnings("unused")
	public Boolean getDraft() {
		return state == PurchaseOrderStateEnum.DRAFT;
	}
}

