package com.ssj.service.conch.teacher.dto;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * @author chchen
 * @date 2018/9/25 10:44
 */
public class SubjectHomeworkDto implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 科目名称
     */
    private String subject;

    /**
     * 作业状态，1全部完成，2部分完成，3无作业
     */
    private int state;

    /**
     * 用时
     */
    private int costTime;

    /**
     * 作业开始时间
     */
    private Long beginTime;

    /**
     * 是否正在计时
     */
    private int type;

    /**
     * 未完成内容列表
     */
    private List<String> unfinishedList;

    /**
     * 图片列表
     */
    private List<HomeworkPictureDto> homeworkPictureList;


    public String getSubject() {
        return subject;
    }

    public void setSubject(String subject) {
        this.subject = subject;
    }

    public int getState() {
        return state;
    }

    public void setState(int state) {
        this.state = state;
    }

    public int getCostTime() {
        return costTime;
    }

    public void setCostTime(int costTime) {
        this.costTime = costTime;
    }

    public Long getBeginTime() {
        return beginTime;
    }

    public void setBeginTime(Long beginTime) {
        this.beginTime = beginTime;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public List<String> getUnfinishedList() {
        return unfinishedList;
    }


    public String unfinish2String() {
        StringBuffer result = new StringBuffer();
        if (this.unfinishedList != null){
            for (String item : this.unfinishedList){
                result.append(item).append(",");
            }
            result.deleteCharAt(result.length() - 1);
        }
        return result.toString();
    }

    public void setUnfinishedList(List<String> unfinishedList) {
        this.unfinishedList = unfinishedList;
    }

    public void addUnfinished(String item){
        if (this.unfinishedList == null){
            this.unfinishedList = new ArrayList<>();
        }
        this.unfinishedList.add(item);
    }

    public List<HomeworkPictureDto> getHomeworkPictureList() {
        return homeworkPictureList;
    }

    public void setHomeworkPictureList(List<HomeworkPictureDto> homeworkPictureList) {
        this.homeworkPictureList = homeworkPictureList;
    }

    public void addHomeworkPicture (HomeworkPictureDto hp){
        if (this.homeworkPictureList == null){
            this.homeworkPictureList = new ArrayList<>();
        }
        this.homeworkPictureList.add(hp);
    }
}
