package com.agilex.vamf.missionhealth.domain.comparator;

import java.util.Comparator;

import com.agilex.vamf.missionhealth.domain.WeeklyServiceMetrics;
import com.agilex.vamf.missionhealth.domain.Service;
public class ServiceAgeComparator implements Comparator<WeeklyServiceMetrics> {

	@Override
	public int compare(WeeklyServiceMetrics weeklyServiceMetrics, WeeklyServiceMetrics weeklyServiceMetrics1) {
		Service.fromString(weeklyServiceMetrics.getService());
		
		if(weeklyServiceMetrics.getWinner().compareTo(weeklyServiceMetrics1.getWinner())==0){
			return Integer.valueOf(Service.fromString(weeklyServiceMetrics.getService()).ordinal()).compareTo(Integer.valueOf(Service.fromString(weeklyServiceMetrics1.getService()).ordinal()));
		}
		else{
			return weeklyServiceMetrics.getWinner()<weeklyServiceMetrics1.getWinner()?-1:1;
		}
	}

}

