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.enums.CostBelongEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.CostTypeEnum;
import com.xunhong.erp.turbo.api.biz.dto.enums.PurchaseOrderStateEnum;
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_cost", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
public class OrderCostDO extends BaseDO<OrderCostDO> {

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

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

	/**
	 * 费用ID
	 */
	@TableField(value = "cost_id")
	private Long costId;

	/**
	 * 成本项目名称
	 */
	@TableField(value = "name")
	private String name;

	/**
	 * 单价
	 */
	@TableField(value = "price")
	private BigDecimal price;

	/**
	 * 单位
	 */
	@TableField(value = "unit")
	private String unit;

	/**
	 * 数量
	 */
	@TableField(value = "count")
	private Integer count;

	/**
	 * 费用归属：0_无归属；1_工头；2_产地；3_司机；
	 */
	@TableField(value = "belong")
	private CostBelongEnum belong;

	/**
	 * 负责人
	 */
	@TableField(value = "principal")
	private String principal;

	/**
	 * 关联项目id
	 */
	@TableField(value = "cost_item_ids", typeHandler = JacksonTypeHandler.class)
	private List<Long> costItemIds;

	/**
	 * 费用类型：1_辅料类型；2_人工类型；3_产地类型；4_其他类型；5_物流类型
	 */
	@TableField(value = "type")
	private CostTypeEnum type;

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

	@TableField(exist = false)
	private PurchaseOrderStateEnum poState;

	@TableField(exist = false)
	private OrderCompanyDO orderCompanyDO;

	@TableField(exist = false)
	private PurchaseOrderDO purchaseOrderDO;

	@TableField(exist = false)
	private OrderVehicleDO orderVehicleDO;

}

