package org.wfc.common.core.utils;

import lombok.extern.slf4j.Slf4j;
import org.wfc.common.core.constant.WifiConstants;
import org.wfc.common.core.exception.OmadaException;

/**
 * @description: reponseutil
 * @author: cyc
 * @since: 2025-02-17
 */
@Slf4j
public class ResponseUtils {

    public static void checkResponse(Integer errorCode, String msg) {
        if (errorCode != WifiConstants.ERROR_CODE_SUCCESS) {
            log.error("Omada error msg: {}", msg);
            throw new OmadaException(msg);
        }
    }

    public static void logResponse(Integer errorCode, String msg) {
        if (errorCode != WifiConstants.ERROR_CODE_SUCCESS) {
            log.error("Omada error msg: {}", msg);
        }
    }

    public static boolean isSuccessResponse(Integer errorCode, String msg) {
        if (errorCode != WifiConstants.ERROR_CODE_SUCCESS) {
            log.error("Omada error msg: {}", msg);
            return false;
        }
        return true;
    }
}
