package cn.com.qmth.stmms.admin.vo;

import java.io.IOException;
import java.io.InputStream;
import java.util.Collections;
import java.util.List;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.databind.ObjectMapper;

/**
 * 卡格式文件内容结构
 */
@JsonIgnoreProperties(ignoreUnknown = true)
public class StructFile {

    private String paperType;

    private List<StructQuestion> objective = Collections.emptyList();

    private List<StructQuestion> subjective = Collections.emptyList();

    public String getPaperType() {
        return paperType;
    }

    public void setPaperType(String paperType) {
        this.paperType = paperType;
    }

    public List<StructQuestion> getObjective() {
        return objective;
    }

    public void setObjective(List<StructQuestion> objective) {
        this.objective = objective;
    }

    public List<StructQuestion> getSubjective() {
        return subjective;
    }

    public void setSubjective(List<StructQuestion> subjective) {
        this.subjective = subjective;
    }

    /**
     * 从输入流解析卡格式文件
     *
     * @param ins
     * @return
     * @throws IOException
     */
    public static StructFile parse(InputStream ins) throws IOException {
        ObjectMapper mapper = new ObjectMapper();
        StructFile obj = mapper.readValue(ins, StructFile.class);
        return obj;
    }
}
