package com.xunhong.erp.turbo.biz.infrastructure.entity;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.xunhong.erp.turbo.api.biz.dto.common.SupplierPackageUsage;
import com.xunhong.erp.turbo.api.biz.dto.common.UploadFileItem;
import com.xunhong.erp.turbo.api.biz.dto.enums.LoadingModeEnum;
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.SupplierTypeEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

/**
 * @author shenyifei
 */
@Data
@TableName(value = "order_supplier", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class OrderSupplierDO extends BaseDO<OrderSupplierDO> {

	/**
	 * 记录ID
	 */
	@TableId(value = "order_supplier_id", type = IdType.ASSIGN_ID)
	private Long orderSupplierId;

	/**
	 * 订单ID
	 */
	@TableField(value = "order_id")
	private Long orderId;

	/**
	 * 供应商ID
	 */
	@TableField(value = "supplier_id")
	private Long supplierId;

	/**
	 * 供应商姓名
	 */
	@TableField(value = "name")
	private String name;

	/**
	 * 收款人姓名
	 */
	private String payeeName;

	/**
	 * 身份证号
	 */
	@TableField(value = "id_card")
	private String idCard;

	/**
	 * 银行卡号
	 */
	@TableField(value = "bank_card")
	private String bankCard;

	/**
	 * 手机号
	 */
	@TableField(value = "phone")
	private String phone;

	/**
	 * 微信二维码
	 */
	@TableField(value = "wechat_qr")
	private String wechatQr;

	/**
	 * 供应商类型：1_瓜农；2_自家档口；3_其他家档口
	 */
	@TableField(value = "type")
	private SupplierTypeEnum type;

	/**
	 * 是否最后一家
	 */
	@TableField(value = "is_last")
	private Boolean isLast;

	/**
	 * 空磅是否包含纸箱
	 */
	@TableField(value = "is_paper")
	private Boolean isPaper;

	/**
	 * 空车重量(kg)
	 */
	@TableField(value = "empty_weight")
	private BigDecimal emptyWeight;

	/**
	 * 总重量(kg)
	 */
	@TableField(value = "total_weight")
	private BigDecimal totalWeight;

	/**
	 * 毛重(kg)
	 */
	@TableField(value = "gross_weight")
	private BigDecimal grossWeight;

	/**
	 * 净重(kg)
	 */
	@TableField(value = "net_weight")
	private BigDecimal netWeight;

	/**
	 * 采购单价(元/斤)
	 */
	@TableField(value = "purchase_price")
	private BigDecimal purchasePrice;

	/**
	 * 箱子类型
	 */
	@TableField(value = "package_usage", typeHandler = JacksonTypeHandler.class)
	private List<SupplierPackageUsage> packageUsage;

	/**
	 * 装车模式：1_搭架子+网垫；2_纸箱+胶带+木隔板
	 */
	@TableField(value = "loading_mode")
	private LoadingModeEnum loadingMode;

	/**
	 * 销售单价(元/斤)
	 */
	@TableField(value = "sale_price")
	private BigDecimal salePrice;

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

	/**
	 * 发票金额
	 */
	@TableField(value = "invoice_amount")
	private BigDecimal invoiceAmount;

	/**
	 * 空车照片
	 */
	@TableField(value = "empty_weight_img")
	private String emptyWeightImg;

	/**
	 * 满载照片
	 */
	@TableField(value = "total_weight_img")
	private String totalWeightImg;

	/**
	 * 是否上传票证
	 */
	@TableField(value = "invoice_upload")
	private Boolean invoiceUpload;

	/**
	 * 发票
	 */
	@TableField(value = "invoice_img", typeHandler = JacksonTypeHandler.class)
	private List<UploadFileItem> invoiceImg;

	/**
	 * 是否上传合同
	 */
	@TableField(value = "contract_upload")
	private Boolean contractUpload;

	/**
	 * 合同
	 */
	@TableField(value = "contract_img", typeHandler = JacksonTypeHandler.class)
	private List<UploadFileItem> contractImg;

	/**
	 * 产品ID
	 */
	@TableField(value = "product_id")
	private Long productId;

	/**
	 * 产品名称
	 */
	@TableField(value = "product_name")
	private String productName;

	/**
	 * 关联费用id
	 */
	@TableField(value = "cost_ids", typeHandler = JacksonTypeHandler.class)
	private List<Long> costIds;

	/**
	 * 费用模板
	 */
	@TableField(value = "cost_template")
	private String costTemplate;

	/**
	 * 是否已付定金
	 */
	@TableField(value = "is_deposit_paid")
	private Boolean isDepositPaid;

	/**
	 * 定金金额
	 */
	@TableField(value = "deposit_amount")
	private BigDecimal depositAmount;

	/**
	 * 是否付款
	 */
	@TableField(value = "is_paid")
	private Boolean isPaid;

	@TableField(exist = false)
	private List<OrderPackageDO> orderPackageDOList;

	@TableField(exist = false)
	private OrderCompanyDO orderCompanyDO;

	@TableField(exist = false)
	private PurchaseOrderDO purchaseOrderDO;

	@TableField(exist = false)
	private PurchaseOrderStateEnum poState;

}
