package com.qmth.teachcloud.mark.entity;

import java.io.Serializable;

import org.apache.commons.collections4.CollectionUtils;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.baomidou.mybatisplus.extension.handlers.JacksonTypeHandler;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.github.jeffreyning.mybatisplus.anno.MppMultiId;
import com.qmth.teachcloud.mark.bean.ArrayResult;
import com.qmth.teachcloud.mark.bean.BoolResult;

import io.swagger.annotations.ApiModel;

/**
 * <p>
 * 
 * </p>
 *
 * @author xf
 * @since 2023-09-22
 */
@TableName(value = "scan_paper_page", autoResultMap = true)
@ApiModel(value = "ScanPaperPage对象", description = "")
public class ScanPaperPage implements Serializable {

	private static final long serialVersionUID = 1L;
	@MppMultiId(value = "paper_id")
	@JsonSerialize(using = ToStringSerializer.class)
	private Long paperId;
	
	@MppMultiId(value = "page_index")
	private Integer pageIndex;

	@TableField(value = "absent", typeHandler = JacksonTypeHandler.class)
	private BoolResult absent;

	@TableField(value = "breach", typeHandler = JacksonTypeHandler.class)
	private BoolResult breach;

	@TableField(value = "question", typeHandler = JacksonTypeHandler.class)
	private ArrayResult question;

	@TableField(value = "selective", typeHandler = JacksonTypeHandler.class)
	private ArrayResult selective;

	private String sheetPath;

	private String recogData;

	@JsonSerialize(using = ToStringSerializer.class)
	private Long creatorId;

	@JsonSerialize(using = ToStringSerializer.class)
	private Long updaterId;

	private Long createTime;

	private Long updateTime;

	public Long getPaperId() {
		return paperId;
	}

	public void setPaperId(Long paperId) {
		this.paperId = paperId;
	}

	public Integer getPageIndex() {
		return pageIndex;
	}

	public void setPageIndex(Integer pageIndex) {
		this.pageIndex = pageIndex;
	}

	public BoolResult getAbsent() {
		return absent;
	}

	public void setAbsent(BoolResult absent) {
		this.absent = absent;
	}

	public BoolResult getBreach() {
		return breach;
	}

	public void setBreach(BoolResult breach) {
		this.breach = breach;
	}

	public ArrayResult getQuestion() {
		return question;
	}

	public void setQuestion(ArrayResult question) {
		this.question = question;
	}

	public ArrayResult getSelective() {
		return selective;
	}

	public void setSelective(ArrayResult selective) {
		this.selective = selective;
	}

	public String getSheetPath() {
		return sheetPath;
	}

	public void setSheetPath(String sheetPath) {
		this.sheetPath = sheetPath;
	}

	public String getRecogData() {
		return recogData;
	}

	public void setRecogData(String recogData) {
		this.recogData = recogData;
	}

	public Long getCreatorId() {
		return creatorId;
	}

	public void setCreatorId(Long creatorId) {
		this.creatorId = creatorId;
	}

	public Long getUpdaterId() {
		return updaterId;
	}

	public void setUpdaterId(Long updaterId) {
		this.updaterId = updaterId;
	}

	public Long getCreateTime() {
		return createTime;
	}

	public void setCreateTime(Long createTime) {
		this.createTime = createTime;
	}

	public Long getUpdateTime() {
		return updateTime;
	}

	public void setUpdateTime(Long updateTime) {
		this.updateTime = updateTime;
	}
	 public boolean isQuestionFilled() {
	        if (question != null) {
	            if (CollectionUtils.isEmpty(question.getResult())) {
	                return false;
	            }
	            for (String s : question.getResult()) {
	                if (!"#".equals(s)) {
	                    return true;
	                }
	            }
	            return false;
	        }
	        return false;
	    }
	@Override
	public String toString() {
		return "ScanPaperPage{" + "paperId=" + paperId + ", pageIndex=" + pageIndex + ", absent=" + absent + ", breach="
				+ breach + ", question=" + question + ", selective=" + selective + ", sheetPath=" + sheetPath
				+ ", recogData=" + recogData + ", creatorId=" + creatorId + ", updaterId=" + updaterId + ", createTime="
				+ createTime + ", updateTime=" + updateTime + "}";
	}
}
