package com.google.firebase.crashlytics.ndk;

import com.revenuecat.purchases.common.diagnostics.DiagnosticsEntry;
import java.util.HashMap;
import org.json.JSONObject;

/* JADX INFO: loaded from: classes3.dex */
class SessionMetadataJsonSerializer {
    private SessionMetadataJsonSerializer() {
    }

    private static String emptyIfNull(String str) {
        return str == null ? "" : str;
    }

    public static String serializeBeginSession(String str, String str2, long j4) {
        HashMap map = new HashMap();
        map.put("session_id", str);
        map.put("generator", str2);
        map.put("started_at_seconds", Long.valueOf(j4));
        return new JSONObject(map).toString();
    }

    public static String serializeSessionApp(String str, String str2, String str3, String str4, int i6, String str5, String str6) {
        HashMap map = new HashMap();
        map.put("app_identifier", str);
        map.put("version_code", str2);
        map.put("version_name", str3);
        map.put("install_uuid", str4);
        map.put("delivery_mechanism", Integer.valueOf(i6));
        map.put("development_platform", emptyIfNull(str5));
        map.put("development_platform_version", emptyIfNull(str6));
        return new JSONObject(map).toString();
    }

    public static String serializeSessionDevice(int i6, String str, int i7, long j4, long j6, boolean z6, int i8, String str2, String str3) {
        HashMap map = new HashMap();
        map.put("arch", Integer.valueOf(i6));
        map.put("build_model", str);
        map.put("available_processors", Integer.valueOf(i7));
        map.put("total_ram", Long.valueOf(j4));
        map.put("disk_space", Long.valueOf(j6));
        map.put("is_emulator", Boolean.valueOf(z6));
        map.put("state", Integer.valueOf(i8));
        map.put("build_manufacturer", str2);
        map.put("build_product", str3);
        return new JSONObject(map).toString();
    }

    public static String serializeSessionOs(String str, String str2, boolean z6) {
        HashMap map = new HashMap();
        map.put(DiagnosticsEntry.VERSION_KEY, str);
        map.put("build_version", str2);
        map.put("is_rooted", Boolean.valueOf(z6));
        return new JSONObject(map).toString();
    }
}
