package com.zjrs.appcomm.template.excel.builder;

import com.zjrs.appcomm.template.excel.mapper.CellStyler;
import com.zjrs.appcomm.template.excel.mapper.RowStyler;
import com.zjrs.appcomm.template.excel.mapper.SheetCoordinate;
import org.apache.poi.ss.usermodel.Sheet;

import java.util.List;
import java.util.Map;

public class ExportDefinition<D, L> {
	
	public static <D, L> ExportBuilder<D, L> builder(Class<D> discreteClass, Class<L> listClass) {
		return new ExportBuilder<>(discreteClass, listClass);
	}
	public ExportDefinition(Class<D> discreteClass, Class<L> listClass) {
		setDiscreteClass(discreteClass);
		setListClass(listClass);
	}
	
	private Class<D> discreteClass;
	public Class<D> getDiscreteClass() { return discreteClass; }
	public void setDiscreteClass(Class<D> discreteClass) { this.discreteClass = discreteClass; }
	
	private Class<L> listClass;
	public Class<L> getListClass() { return listClass; }
	public void setListClass(Class<L> listClass) { this.listClass = listClass; }

	/* Excel中Sheet */
	private Sheet sheet;
	public Sheet getSheet() { return sheet; }
	public void setSheet(Sheet sheet) { this.sheet = sheet; }
	
	/* 离散数据 */
	private D discreteData;
	public D getDiscreteData() { return discreteData; }
	public void setDiscreteData(D discreteData) { this.discreteData = discreteData; }
	
	/* 离散数据坐标 */
	private Map<String, SheetCoordinate> discreteFieldCoordinates;
	public Map<String, SheetCoordinate> getDiscreteFieldCoordinates() { return discreteFieldCoordinates; }
	public void setDiscreteFieldCoordinates(Map<String, SheetCoordinate> discreteFieldCoordinates) { this.discreteFieldCoordinates = discreteFieldCoordinates; }
	
	/* 离散数据单元格默认样式处理 */
	private CellStyler discreteDefaultDataStyler;
	public CellStyler getDiscreteDefaultDataStyler() { return discreteDefaultDataStyler; }
	public void setDiscreteDefaultDataStyler(CellStyler discreteDefaultDataStyler) { this.discreteDefaultDataStyler = discreteDefaultDataStyler; }
	
	/* 列表数据表头所在行下标 */
	private int listHeaderRowIndex;
	public int getListHeaderRowIndex() { return listHeaderRowIndex; }
	public void setListHeaderRowIndex(int listHeaderRowIndex) { this.listHeaderRowIndex = listHeaderRowIndex; }
	
	/* 列表数据表头名称 */
	private String[][] listHeaders;
	public String[][] getListHeaders() { return listHeaders; }
	public void setListHeaders(String[][] listHeaders) { this.listHeaders = listHeaders; }
	
	/* 列表数据字段映射 */
	private String[] listFields;
	public String[] getListFields() { return listFields; }
	public void setListFields(String[] listFields) { this.listFields = listFields; }
	
	/* 列表数据表头行样式处理 */
	private RowStyler listHeaderRowStyler;
	public RowStyler getListHeaderRowStyler() { return listHeaderRowStyler; }
	public void setListHeaderRowStyler(RowStyler listHeaderRowStyler) { this.listHeaderRowStyler = listHeaderRowStyler; }
	
	/* 列表数据表头单元格样式处理 */
	private CellStyler listHeaderCellStyler;
	public CellStyler getListHeaderCellStyler() { return listHeaderCellStyler; }
	public void setListHeaderCellStyler(CellStyler listHeaderCellStyler) { this.listHeaderCellStyler = listHeaderCellStyler; }
	
	/* 列表数据的起始行下标 */
	private int listDataRowIndex;
	public int getListDataRowIndex() { return listDataRowIndex; }
	public void setListDataRowIndex(int listDataRowIndex) { this.listDataRowIndex = listDataRowIndex; }
	
	/* 列表数据 */
	private List<L> listData;
	public List<L> getListData() { return listData; }
	public void setListData(List<L> listData) { this.listData = listData; }
	
	/* 列表数据行样式处理 */
	private RowStyler listDataRowStyler;
	public RowStyler getListDataRowStyler() { return listDataRowStyler; }
	public void setListDataRowStyler(RowStyler listDataRowStyler) { this.listDataRowStyler = listDataRowStyler; }
	
	/* 列表数据单元格样式处理 */
	private CellStyler listDataCellStyler;
	public CellStyler getListDataCellStyler() { return listDataCellStyler; }
	public void setListDataCellStyler(CellStyler listDataCellStyler) { this.listDataCellStyler = listDataCellStyler; }
	
}
