package com.todoist.model;

public class BaseLabel extends TodoistObjectWithId implements Comparable<BaseLabel> {
    public static final String[] COLORS = Colors.LABEL_COLORS;
    public static final int DEFAULT_COLOR = Colors.DEFAULT_LABEL_COLOR;

    private String name;
    private int color;

    public BaseLabel(long id, String name, int color, boolean deleted) {
        super(id, deleted);
        this.name = name;
        this.color = color;
    }

    public BaseLabel(long id, String name, int color) {
        this(id, name, color, false);
    }

    public BaseLabel(long id, String name) {
        this(id, name, Colors.DEFAULT_LABEL_COLOR, false);
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        if (name != null) {
            name = name.trim().replaceAll("\\s+", "_");
        }

        this.name = name;
    }

    /**
     * Returns the color index in {@link #COLORS}.
     */
    public int getColor() {
        return color;
    }

    /**
     * Returns the color index in {@link #COLORS} within the available bounds. If outside those bounds, the default
     * color index is returned.
     */
    public int getColorWithinBounds() {
        if(color < 0 || color > COLORS.length - 1) {
            return DEFAULT_COLOR;
        } else {
            return color;
        }
    }

    public void setColor(int color) {
        this.color = color;
    }

    @Override
    public int compareTo(BaseLabel other) {
        return getId() < other.getId() ? -1 : (getId() == other.getId() ? 0 : 1);
    }
}

@@ -21,16 +21,49 @@
 model;%0A%0A
+import java.util.regex.Pattern;%0A%0A
 public c
@@ -108,41 +108,8 @@
 thId
- implements Comparable%3CBaseLabel%3E
  %7B%0A 
@@ -243,16 +243,91 @@
 COLOR;%0A%0A
+    private static final Pattern spacesPattern = Pattern.compile(%22%5C%5Cs+%22);%0A%0A
     priv
@@ -365,16 +365,43 @@
 t color;
+%0A    private int itemOrder;
 %0A%0A    pu
@@ -447,16 +447,31 @@
 t color,
+ int itemOrder,
  boolean
@@ -556,32 +556,68 @@
 .color = color;%0A
+        this.itemOrder = itemOrder;%0A
     %7D%0A%0A    publi
@@ -651,32 +651,47 @@
  name, int color
+, int itemOrder
 ) %7B%0A        this
@@ -707,16 +707,27 @@
 , color,
+ itemOrder,
  false);
@@ -767,32 +767,47 @@
  id, String name
+, int itemOrder
 ) %7B%0A        this
@@ -844,16 +844,27 @@
 L_COLOR,
+ itemOrder,
  false);
@@ -1011,24 +1011,46 @@
      name = 
+spacesPattern.matcher(
 name.trim().
@@ -1048,16 +1048,17 @@
 e.trim()
+)
 .replace
@@ -1065,16 +1065,8 @@
 All(
-%22%5C%5Cs+%22, 
 %22_%22)
@@ -1667,142 +1667,149 @@
     
-@Override%0A    public int compareTo(BaseLabel other) %7B%0A        return getId() %3C other.getId() ? -1 : (getId() == other.getId() ? 0 : 1)
+public int getItemOrder() %7B%0A        return itemOrder;%0A    %7D%0A%0A    public void setItemOrder(int itemOrder) %7B%0A        this.itemOrder = itemOrder
 ;%0A  

Add itemOrder to Label, unimplement Comparable