package cn.gov.customs.wxjy.common.importtool.model;

import lombok.Builder;
import lombok.Data;

import java.util.List;

@Data
@Builder
public class ImportResult<T> {
	private boolean success;
	private String message;
	private int successCount;
	private int totalCount;
	private int newCount;      // 新增数据数量
	private int updateCount;   // 更新数据数量
	private List<ImportError> errors;

	private List<T> addList;
	private List<T> updateList;

	public static  <T> ImportResult<T>  failure(String message) {
		return ImportResult.<T>builder()
			.success(false)
			.message(message)
			.successCount(0)
			.totalCount(0)
			.newCount(0)
			.updateCount(0)
			.addList(null)
			.updateList(null)
			.build();
	}
}
