package com.qmth.teachcloud.mark.dto;

import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;

public class ScanOmrTaskResultDto {

    @NotNull(message = "任务ID不能为空")
    private Long id;

    @Valid
    @NotNull(message = "任务pages不能为空")
    @Size(min = 1, message = "任务pages不能为空")
    private List<ScanOmrTaskResultPageDto> pages;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public List<ScanOmrTaskResultPageDto> getPages() {
        return pages;
    }

    public ScanOmrTaskResultPageDto findPage(Integer index) {
        if (pages != null) {
            for (ScanOmrTaskResultPageDto vo : pages) {
                if (vo.getIndex().equals(index)) {
                    return vo;
                }
            }
        }
        return null;
    }

    public void setPages(List<ScanOmrTaskResultPageDto> pages) {
        this.pages = pages;
    }

}
