package studycave.studycaverestservice.model.user.dto;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Getter
@Setter
@AllArgsConstructor
@NoArgsConstructor
public class LeaderboardDTO implements Comparable {
    private String Username;
    private String Name;
    private String Surname;
    private float points;


    @Override
    public int compareTo(Object o) {
        int result = this.getUsername().compareTo(((LeaderboardDTO) o).getUsername());
        if(result == 0) {
            result = (this.getPoints() < ((LeaderboardDTO) o).getPoints() ? -1 : (this.getPoints() == ((LeaderboardDTO) o).getPoints() ? 0 : 1));
        }
        return  result;
    }
}
