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

import com.alibaba.fastjson.annotation.JSONField;
import org.apache.commons.lang3.StringUtils;

import java.io.Serializable;
import java.util.Objects;

/**
 * @description
 * @author yrf
 * @time 2020/3/23 17:36
 */
public class ExerciseTeacherDTO implements Serializable {


    private static final long serialVersionUID = -3764035179314995279L;

    private String teacherId;
    private String image;
    private String name;
    private String subject;

    @JSONField(serialize = false)
    private String authority;

    private String teacherTypeStr;

    @JSONField(serialize = false)
    private Integer isBanned;

    @JSONField(serialize = false)
    private Integer isCancelled;

    @JSONField(serialize = false)
    private Integer isFormal;

    /**
     * 角色状态 1考核中，2在职， 3已冻结，4已注销
     */
    private Integer teacherWorkingType;

    private Integer totalCount;
    private Integer unFinishCount;

    private Integer questionTotalCount;
    private Integer questionUnfinishCount;

    public String getTeacherId() {
        return teacherId;
    }

    public void setTeacherId(String teacherId) {
        this.teacherId = teacherId;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getSubject() {
        return subject;
    }

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

    public String getTeacherTypeStr() {
        if (StringUtils.isNotBlank(teacherTypeStr)) {
            return teacherTypeStr;
        }

        StringBuilder teacherTypeBuilder = new StringBuilder("");
        if (authority.contains("1")) {
            teacherTypeBuilder.append("加工、");
        }
        if (authority.contains("2")) {
            teacherTypeBuilder.append("加审、");
        }
        if (authority.contains("3")) {
            teacherTypeBuilder.append("解析、");
        }
        if (authority.contains("4")) {
            teacherTypeBuilder.append("解审、");
        }
        if (teacherTypeBuilder.length() > 0) {
            teacherTypeBuilder.deleteCharAt(teacherTypeBuilder.length() - 1);
        }
        teacherTypeStr = teacherTypeBuilder.toString();

        return teacherTypeStr;
    }

    public void setTeacherTypeStr(String teacherTypeStr) {
        this.teacherTypeStr = teacherTypeStr;
    }

    public Integer getIsBanned() {
        return isBanned;
    }

    public void setIsBanned(Integer isBanned) {
        this.isBanned = isBanned;
    }

    public Integer getIsCancelled() {
        return isCancelled;
    }

    public void setIsCancelled(Integer isCancelled) {
        this.isCancelled = isCancelled;
    }

    public Integer getIsFormal() {
        return isFormal;
    }

    public void setIsFormal(Integer isFormal) {
        this.isFormal = isFormal;
    }

    public Integer getTeacherWorkingType() {
        if (teacherWorkingType != null) {
            return teacherWorkingType;
        }

        if (Objects.equals(isCancelled, 1)) {
            teacherWorkingType = 4;
        } else if (Objects.equals(isBanned, 1)) {
            teacherWorkingType = 3;
        } else if (Objects.equals(isFormal, 1)) {
            teacherWorkingType = 2;
        } else {
            teacherWorkingType = 1;
        }

        return teacherWorkingType;
    }

    public void setTeacherWorkingType(Integer teacherWorkingType) {
        this.teacherWorkingType = teacherWorkingType;
    }

    public Integer getTotalCount() {
        return totalCount;
    }

    public void setTotalCount(Integer totalCount) {
        this.totalCount = totalCount;
    }

    public Integer getUnFinishCount() {
        return unFinishCount;
    }

    public void setUnFinishCount(Integer unFinishCount) {
        this.unFinishCount = unFinishCount;
    }

    public String getAuthority() {
        return authority;
    }

    public void setAuthority(String authority) {
        this.authority = authority;
    }

    public Integer getQuestionTotalCount() {
        return questionTotalCount;
    }

    public void setQuestionTotalCount(Integer questionTotalCount) {
        this.questionTotalCount = questionTotalCount;
    }

    public Integer getQuestionUnfinishCount() {
        return questionUnfinishCount;
    }

    public void setQuestionUnfinishCount(Integer questionUnfinishCount) {
        this.questionUnfinishCount = questionUnfinishCount;
    }
}
