package com.nurulwafa.nufakuproject;

public class ApiHelper {

    private static final String EMULATOR_BASE_URL = "http://10.0.2.2:8080/admin-nufa/api/";
    private static final String DEVICE_BASE_URL = "http://192.168.0.80:8080/admin-nufa/api/";
    private static final String HOSTING_BASE_URL = "https://admin-nufa.my.id/api/";

    public static String getBaseUrl() {
        boolean useHosting = true; //  Ubah ke true nanti saat hosting aktif

        if (useHosting) {
            return HOSTING_BASE_URL;
        }

        if (isEmulator()) {
            return EMULATOR_BASE_URL;
        } else {
            return DEVICE_BASE_URL;
        }
    }

    private static boolean isEmulator() {
        return android.os.Build.FINGERPRINT.contains("generic") ||
                android.os.Build.MODEL.contains("Emulator") ||
                android.os.Build.HARDWARE.contains("goldfish") ||
                android.os.Build.PRODUCT.contains("sdk");
    }
}


