package org.tndata.android.compass.model;

import java.io.Serializable;
import java.util.ArrayList;

public class Goal extends TDCBase implements Serializable, Comparable<Goal> {

    private static final long serialVersionUID = 7109406671934150671L;
    private String subtitle = "";
    private String outcome = "";
    private String icon_url = "";
    private ArrayList<Category> categories = new ArrayList<Category>();
    private ArrayList<Behavior> behaviors = new ArrayList<Behavior>();

    public Goal() {
    }

    public Goal(int id, int order, String title, String titleSlug,
                String description, String subtitle, String outcome, String iconUrl) {
        super(id, title, titleSlug, description);
        this.subtitle = subtitle;
        this.outcome = outcome;
        this.icon_url = iconUrl;
        this.categories = new ArrayList<Category>();
    }

    public Goal(int id, int order, String title, String titleSlug,
                String description, String subtitle, String outcome,
                String iconUrl, ArrayList<Category> categories) {
        super(id, title, titleSlug, description);
        this.subtitle = subtitle;
        this.outcome = outcome;
        this.icon_url = iconUrl;
        this.categories = categories;
    }

    public String getOutcome() {
        return outcome;
    }

    public void setOutcome(String outcome) {
        this.outcome = outcome;
    }

    public String getSubtitle() {
        return subtitle;
    }

    public void setSubtitle(String subtitle) {
        this.subtitle = subtitle;
    }

    public String getIconUrl() {
        return icon_url;
    }

    public void setIconUrl(String icon_url) {
        this.icon_url = icon_url;
    }

    public ArrayList<Category> getCategories() {
        return categories;
    }

    public void setCategories(ArrayList<Category> categories) {
        this.categories = categories;
    }

    public ArrayList<Behavior> getBehaviors() {
        return behaviors;
    }

    public void setBehaviors(ArrayList<Behavior> behaviors) {
        this.behaviors = behaviors;
    }


    @Override
    public boolean equals(Object object) {
        boolean result = false;
        if (object == null) {
            result = false;
        } else if (object == this) {
            result = true;
        } else if (object instanceof Goal) {
            if (this.getId() == ((Goal) object).getId()) {
                result = true;
            }
        }
        return result;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 7 * hash + this.getTitle().hashCode();
        return hash;
    }

    @Override
    public int compareTo(Goal another) {
        if (getId() == another.getId()) {
            return 0;
        } else if (getId() < another.getId()) {
            return -1;
        } else
            return 1;
    }
}

@@ -36,16 +36,53 @@
 model;%0A%0A
+import org.tndata.android.compass.R;%0A
 import j
@@ -524,16 +524,84 @@
 vior%3E();
+%0A    private double progress_value = 0.0; // Only used for UserGoals
 %0A%0A    pu
@@ -2212,16 +2212,975 @@
 %0A    %7D%0A%0A
+    public void setProgressValue(double value) %7B%0A        this.progress_value = value;%0A    %7D%0A%0A    public double getProgressValue() %7B%0A        return this.progress_value;%0A    %7D%0A%0A    public int getProgressIcon() %7B%0A        double value = getProgressValue();%0A        if (value %3C 0.125) %7B%0A            return R.drawable.compass_9_s;%0A        %7D else if (value %3C 0.25) %7B%0A            return R.drawable.compass_8_sse;%0A        %7D else if (value %3C 0.375) %7B%0A            return R.drawable.compass_7_se;%0A        %7D else if (value %3C 0.5) %7B%0A            return R.drawable.compass_6_ees;%0A        %7D else if (value %3C 0.625) %7B%0A            return R.drawable.compass_5_e;%0A        %7D else if (value %3C 0.75) %7B%0A            return R.drawable.compass_4_nee;%0A        %7D else if (value %3C 0.875) %7B%0A            return R.drawable.compass_3_ne;%0A        %7D else if (value %3C 0.95) %7B%0A            return R.drawable.compass_2_nne;%0A        %7D else %7B%0A            return R.drawable.compass_1_n;%0A        %7D%0A    %7D%0A
 %0A    @Ov

Add a progress_value field for a Goal with a method for it to retreive an icon id related to that value