package cn.com.qmth.stmms.ms.core.domain.user;

import cn.com.qmth.stmms.ms.core.vo.Subject;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.validation.constraints.NotNull;
import java.util.Random;

/**
 * Created by zhengmin on 2016/10/4.
 */
@Entity
public class MarkUser extends AbstractUser {

    private static final long serialVersionUID = -8261921661291192687L;

    @Enumerated(value = EnumType.STRING)
    private Subject subject;

    @NotNull
    private Long workId;

    @NotNull
    private Long organizationId;

    @Enumerated(value = EnumType.STRING)
    private Role role;

    private Long groupId;

    private MarkRight markRight;

    @Column(name = "inspect_sc")
    private Boolean inspectSC;

    @Column(name = "inspect_sm")
    private Boolean inspectSM;

    @Column(name = "inspect_sx")
    private Boolean inspectSX;

    private Double weight;

    private boolean oneClickLevel;

    private boolean standardVolume;

    private boolean levelCallback;

    private Integer displayCount;

    private Boolean defaultAccount;

    //机构账号类型（临时字段，1-机构，2-项目经理）
    private String userType;

    public boolean getLevelCallback() {
        return levelCallback;
    }

    public void setLevelCallback(boolean levelCallback) {
        this.levelCallback = levelCallback;
    }

    public static long getSerialVersionUID() {
        return serialVersionUID;
    }

    public boolean getOneClickLevel() {
        return oneClickLevel;
    }

    public void setOneClickLevel(boolean oneClickLevel) {
        this.oneClickLevel = oneClickLevel;
    }

    public MarkUser(String loginName,
                    String password,
                    Long workId,
                    Subject subject,
                    String name,
                    Role role,
                    Double weight) {
        super(loginName, password);
        this.workId = workId;
        this.subject = subject;
        this.setName(name);
        this.role = role;
        this.weight = weight;
    }

    public MarkUser() {
        super();
        StringBuilder sb = new StringBuilder();
        for (int i = 0; i < 6; i++) {
            Random ran = new Random();
            int x = ran.nextInt(9);
            sb.append(x);
        }
//        this.setPassword("123456");
    }

    public Subject getSubject() {
        return subject;
    }

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

    public Long getWorkId() {
        return workId;
    }

    public void setWorkId(Long workId) {
        this.workId = workId;
    }

    public Role getRole() {
        return role;
    }

    public void setRole(Role role) {
        this.role = role;
    }

    public Long getGroupId() {
        return groupId;
    }

    public void setGroupId(Long groupId) {
        this.groupId = groupId;
    }

    public MarkRight getMarkRight() {
        return markRight;
    }

    public void setMarkRight(MarkRight markRight) {
        this.markRight = markRight;
    }

    public Boolean getInspectSC() {
        return inspectSC;
    }

    public void setInspectSC(Boolean inspectSC) {
        this.inspectSC = inspectSC;
    }

    public Boolean getInspectSM() {
        return inspectSM;
    }

    public void setInspectSM(Boolean inspectSM) {
        this.inspectSM = inspectSM;
    }

    public Boolean getInspectSX() {
        return inspectSX;
    }

    public void setInspectSX(Boolean inspectSX) {
        this.inspectSX = inspectSX;
    }

    public Double getWeight() {
        return weight;
    }

    public void setWeight(Double weight) {
        this.weight = weight;
    }

    public boolean getStandardVolume() {
        return standardVolume;
    }

    public void setStandardVolume(boolean standardVolume) {
        this.standardVolume = standardVolume;
    }

    public Integer getDisplayCount() {
        return displayCount;
    }

    public void setDisplayCount(Integer displayCount) {
        this.displayCount = displayCount;
    }

    public Boolean getDefaultAccount() {
        return defaultAccount;
    }

    public void setDefaultAccount(Boolean defaultAccount) {
        this.defaultAccount = defaultAccount;
    }

    public Long getOrganizationId() {
        return organizationId;
    }

    public void setOrganizationId(Long organizationId) {
        this.organizationId = organizationId;
    }

    public String getUserType() {
        return userType;
    }

    public void setUserType(String userType) {
        this.userType = userType;
    }
}
