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.OrderSupplierInvoice;
import com.xunhong.erp.turbo.api.biz.dto.common.UploadFileItem;
import com.xunhong.erp.turbo.api.biz.dto.enums.SupplierInvoiceTypeEnum;
import com.xunhong.erp.turbo.datasource.domain.entity.BaseDO;
import lombok.Data;
import lombok.EqualsAndHashCode;

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

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

	/**
	 * 发票ID
	 */
	@TableId(value = "supplier_invoice_id", type = IdType.ASSIGN_ID)
	private Long supplierInvoiceId;

	/**
	 * 发票类型：1_瓜农
	 */
	@TableField(value = "type")
	private SupplierInvoiceTypeEnum type;

	/**
	 * 发票开具人
	 */
	@TableField(value = "supplier_id")
	private Long supplierId;

	/**
	 * 发票开具人名称
	 */
	@TableField(value = "supplier_name")
	private String supplierName;

	/**
	 * 代开发票人的信息
	 */
	@TableField(value = "order_supplier_invoice", typeHandler = JacksonTypeHandler.class)
	private List<OrderSupplierInvoice> orderSupplierInvoiceList;

	/**
	 * 发票图片（支持多张）
	 */
	@TableField(value = "invoice_img", typeHandler = JacksonTypeHandler.class)
	private List<UploadFileItem> invoiceImg;

	/**
	 * 登记时间
	 */
	@TableField(value = "registration_time")
	private LocalDateTime registrationTime;

	/**
	 * 创建人ID
	 */
	@TableField(value = "created_by")
	private Long createdBy;

	/**
	 * 创建人姓名
	 */
	@TableField(value = "created_by_name")
	private String createdByName;

}

