package com.mzh.library.entity;

public class UserSearchCriteria {
    public static final String ACTIVE_STATUS = "active";
    public static final String INACTIVE_STATUS = "inactive";

    private String keyword;
    private String roleCode;
    private String activeStatus;

    public UserSearchCriteria() {
        this(null, null, null);
    }

    public UserSearchCriteria(String keyword, String roleCode, String activeStatus) {
        this.keyword = trim(keyword);
        this.roleCode = trim(roleCode);
        this.activeStatus = trim(activeStatus);
    }

    public String getKeyword() {
        return keyword;
    }

    public void setKeyword(String keyword) {
        this.keyword = trim(keyword);
    }

    public String getRoleCode() {
        return roleCode;
    }

    public void setRoleCode(String roleCode) {
        this.roleCode = trim(roleCode);
    }

    public String getActiveStatus() {
        return activeStatus;
    }

    public void setActiveStatus(String activeStatus) {
        this.activeStatus = trim(activeStatus);
    }

    public Boolean getActiveValue() {
        if (ACTIVE_STATUS.equals(activeStatus)) {
            return Boolean.TRUE;
        }
        if (INACTIVE_STATUS.equals(activeStatus)) {
            return Boolean.FALSE;
        }
        return null;
    }

    private String trim(String value) {
        return value == null ? "" : value.trim();
    }
}
