package org.commcare.android.resource;

import org.commcare.android.models.notifications.MessageTag;

public enum AppInstallStatus implements MessageTag {
    // Success states:
    Installed("notification.install.installed"),
    UpToDate("notification.install.uptodate"),
    /**
     * Update has been downloaded into update table
     */
    UpdateStaged("notification.install.updatestaged"),

    // Error states:
    MissingResources("notification.install.missing"),
    MissingResourcesWithMessage("notification.install.missing.withmessage"),
    IncompatibleReqs("notification.install.badreqs"),
    UnknownFailure("notification.install.unknown"),
    NoLocalStorage("notification.install.nolocal"),
    NoConnection("notification.install.no.connection"),

    /**
     * Attempting to install an app that is already installed
     */
    DuplicateApp("notification.install.duplicate"),

    BadCertificate("notification.install.badcert");


    AppInstallStatus(String root) {
        this.root = root;
    }

    private final String root;

    public String getLocaleKeyBase() {
        return root;
    }

    public boolean canReusePartialUpdateTable() {
        return (this == UnknownFailure || this == NoLocalStorage);
    }

    public boolean isUpdateInCompletedState() {
        return (this == UpdateStaged || this == UpToDate);
    }

    public String getCategory() {
        return "install_update";
    }
}

@@ -160,22 +160,42 @@
 // S
-uccess states:
+tatuses unique to app installation
 %0A   
@@ -244,24 +244,117 @@
 %22),%0A    
-UpToDate
+/**%0A     * Error when attempting to install an app that is already installed%0A     */%0A    DuplicateApp
 (%22notifi
@@ -372,19 +372,60 @@
 all.
+d
 up
-tod
+lic
 ate%22),
+%0A%0A    // Statuses unique to app updating
 %0A   
@@ -554,22 +554,193 @@
    /
-/ Error states
+**%0A     * Update attempt resulted in no new updates being found.%0A     */%0A    UpToDate(%22notification.install.uptodate%22),%0A%0A    // Error states shared by both app installation and updating
 :%0A  
@@ -1086,140 +1086,8 @@
 %22),%0A
-%0A    /**%0A     * Attempting to install an app that is already installed%0A     */%0A    DuplicateApp(%22notification.install.duplicate%22),%0A%0A
     
@@ -1135,17 +1135,16 @@
 ert%22);%0A%0A
-%0A
     AppI

Reorganize install/update statuses