package com.ssj.service.kmt.exercisesys.dto;

import com.alibaba.fastjson.annotation.JSONField;

import java.io.Serializable;

/**
 * @author yrf
 * @time 2020/5/20 14:26
 */
public class ExerciseDistributionCountDTO implements Serializable {

    private static final long serialVersionUID = -3774170751213051880L;

    private Integer notDistributedExerciseBookCount;
    private Integer distributedExerciseBookCount;

    @JSONField(serialize = false)
    private Integer totalExerciseBookCount;

    public Integer getNotDistributedExerciseBookCount() {
        return notDistributedExerciseBookCount;
    }

    public void setNotDistributedExerciseBookCount(Integer notDistributedExerciseBookCount) {
        this.notDistributedExerciseBookCount = notDistributedExerciseBookCount;
    }

    public Integer getDistributedExerciseBookCount() {
        if (distributedExerciseBookCount != null) {
            return distributedExerciseBookCount;
        }

        if (totalExerciseBookCount == null || totalExerciseBookCount < 1) {
            distributedExerciseBookCount = 0;
        } else if (notDistributedExerciseBookCount == null) {
            distributedExerciseBookCount = totalExerciseBookCount;
        } else {
            distributedExerciseBookCount = totalExerciseBookCount - notDistributedExerciseBookCount;
        }

        return distributedExerciseBookCount;
    }

    public void setDistributedExerciseBookCount(Integer distributedExerciseBookCount) {
        this.distributedExerciseBookCount = distributedExerciseBookCount;
    }

    public Integer getTotalExerciseBookCount() {
        return totalExerciseBookCount;
    }

    public void setTotalExerciseBookCount(Integer totalExerciseBookCount) {
        this.totalExerciseBookCount = totalExerciseBookCount;
    }
}
