package com.crackingbits.bummer.model;


import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.Date;

/**
 * Created by klimoma on 03.08.2016.
 */
public class Ticket {
    public int id;
    public String nameFrom;
    public String mailFrom;
    public String description;
    public String subject;
    public Boolean overdue;
    public int priority;

    public static ArrayList<Ticket> sortJobsByPriority(ArrayList<Ticket> tickets){

        Collections.sort(tickets, new Comparator<Ticket>() {
            public int compare(Ticket t1, Ticket t2) {
                if(t1.priority == t2.priority )
                    return t2.id - t1.id;
               return t2.priority - t1.priority;
            }
        });
        return tickets;
    }
}
