package com.foxx.androidcast.crash;

/*********************************************************************
 * CrashSettings.java
 * Created at: Wed 20 May 2026 14:31:55 +0200
 * Updated at: Wed 20 May 2026 15:17:13 +0200 by Anton Afanasyeu <a.afanasieff@gmail.com>
 * Commit: 5d8e82d2e60a21fff3138d2a394ee4e8b4c6dcb8
 * class CrashSettings
 * Contributors:
 *    - Anton Afanasyeu <a.afanasieff@gmail.com> (2 commits, 29 lines)
 *    - Cursor Agent (project assistant)
 * Digest: SHA256	b34e77953e2e8e034a359a5f0d1a86a6a5fd915b2acbda19af1d07bb20cef58e
**********************************************************************/
/** Crash reporter tuning from {@code settings.json} → {@code crash} (overrides app defaults). */
public final class CrashSettings {
    public static final String DEFAULT_UPLOAD_URL =
            "https://apps.f0xx.org/app/androidcast_project/crashes/api/upload.php";

    public final boolean enabled;
    public final String uploadUrl;
    public final boolean pruneAfterUpload;
    public final long uploadIntervalMs;
    public final int maxPendingFiles;

    public CrashSettings(boolean enabled, String uploadUrl, boolean pruneAfterUpload,
            long uploadIntervalMs, int maxPendingFiles) {
        this.enabled = enabled;
        this.uploadUrl = uploadUrl != null ? uploadUrl.trim() : DEFAULT_UPLOAD_URL;
        this.pruneAfterUpload = pruneAfterUpload;
        this.uploadIntervalMs = Math.max(30_000L, uploadIntervalMs);
        this.maxPendingFiles = Math.max(1, maxPendingFiles);
    }
}
