package com.example.offlinestore1

import android.graphics.drawable.Drawable
import java.io.File
import java.util.Locale

data class AppModel(
    val name: String,
    val icon: Drawable?,
    val packageName: String,
    val apkFile: File,
    var isInstalled: Boolean,
    val category: String,
    val sizeText: String,
    var versionCode: Int = 0,
    var installedVersionCode: Int = -1, // שדה חדש לשיפור ביצועי גלילה
    var installState: String = "idle",
    var progress: Int = 0,
    var statusText: String = ""
) {
    companion object {
        fun formatSize(bytes: Long): String {
            val mb = bytes / (1024.0 * 1024.0)
            return String.format(Locale.US, "גודל %.1f MB", mb)
        }
    }
}