package com.nokia.sms.sgip.mo.server;

import com.nokia.sms.sgip.SgipConfig;
import com.nokia.sms.sgip.message.BindMessage;

import lombok.extern.slf4j.Slf4j;

@Slf4j
public class BindChecker {
    public static byte checkBindMessage(BindMessage message) {
        byte result = -1;
        String loginName = SgipConfig.getConfig().getString("sgip_mo_login_name", "");
        String loginPasswd = SgipConfig.getConfig().getString("sgip_mo_login_password", "");
        log.debug("[Config:loginName=" + loginName + ",loginPasswd=" + loginPasswd + "]");
        if ((loginName.equals(message.getLoginName())) && (loginPasswd.equals(message.getLoginPassword()))) {
            result = 0;
        } else {
            log.warn(message + ".[Config:loginName=" + loginName + ",loginPasswd=" + loginPasswd + "]");
            result = 1;
        }
        return result;
    }
}
