package org.springblade.flow.visual.onlinedev.formdata.excel;

import java.util.List;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * 批量导入表单数据参数
 * 
 * @author william
 * @date 2022年9月14日 下午1:57:56
 */
@Data
@ApiModel(value = "ExcelFormParam", description = "批量导入表单数据参数")
public class ExcelFormParam {
	@ApiModelProperty(value = "备注", name = "name", required = false)
	private String name;

	@ApiModelProperty(value = "表单ID", name = "modelId", required = true)
	private String modelId;

	@ApiModelProperty(value = "excel相对路径", name = "file", required = true)
	private String file;

	@ApiModelProperty(value = "excel是否带表头", name = "withHeader", required = true)
	private Boolean withHeader;

	@ApiModelProperty(value = "字段ID和Excel列索引映射关系", name = "list", required = true)
	private List<ExcelFieldIndex> list;
	
	@ApiModelProperty(value = "是否清空原有数据", name = "isTruncate", required = true)
	private boolean isTruncate;

	@Data
	@ApiModel(value = "ExcelFieldIndex", description = "字段ID和Excel列索引映射关系")
	public static class ExcelFieldIndex {

		@ApiModelProperty(value = "Excel列索引（从0开始）", name = "index", required = true)
		private int index;

		@ApiModelProperty(value = "字段ID", name = "fieldId", required = true)
		private int fieldId;

		public ExcelFieldIndex() {
		}

		public ExcelFieldIndex(Integer index, Integer fieldId) {
			super();
			this.index = index;
			this.fieldId = fieldId;
		}
	}
}
