package com.example.henzoshimada.feeltrip;

import java.util.ArrayList;

import io.searchbox.annotations.JestId;

/**
 * Created by Esus2 on 2017-03-20.
 */

public class Participant {
    private String userName;
    private String password;
    private ArrayList<FollowRequest> followRequest;
    private ArrayList<String> following;

    @JestId
    private String id;

    public Participant(){
        this.userName = null;
        this.password = null;
        this.followRequest = new ArrayList<>();
        this.following = new ArrayList<>();
    }

    public Participant(String userName, String password){
        this.userName = userName;
        this.password = password;
        this.followRequest = new ArrayList<>();
        this.following = new ArrayList<>();
    }

    public String getUserName() {
        return userName;
    }

    public void setUserName(String userName) {
        this.userName = userName;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public void addAllFollowing(ArrayList<String> following){
        this.following.addAll(following);
    }

    public void addFollowing(String userName){
        if (!this.following.contains(userName)) {
            this.following.add(userName);
        }
    }

    public void addAllFollowRequest(ArrayList<FollowRequest> followRequest){
        for (FollowRequest request: followRequest){
            if (!this.followRequest.contains(request)){
                this.followRequest.add(request);
            }
        }

    }

    public void unFollow(String nameUnfollowing){
        if (this.following.contains(nameUnfollowing)) {
            this.following.remove(nameUnfollowing);
        }
    }


    /*
    public void addFollowRequest(String followerName){
        followRequest.add(followerName);
    }


    public void deleteFollowRequest(String nameWantToDelete){
        if (followRequest.contains(nameWantToDelete)){
            followRequest.remove(nameWantToDelete);
        }
    }
    */

    public ArrayList<FollowRequest> getFollowRequest() {
        return followRequest;
    }

    public ArrayList<String> getFollowing() {
        return following;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }
}

@@ -330,16 +330,76 @@
 owing;%0A%0A
+    private double longitude;%0A    private double latitude;%0A%0A
     @Jes
@@ -2322,32 +2322,346 @@
 llowing;%0A    %7D%0A%0A
+    public double getLongitude() %7B%0A        return longitude;%0A    %7D%0A%0A    public void setLongitude(double longitude) %7B%0A        this.longitude = longitude;%0A    %7D%0A%0A    public double getLatitude() %7B%0A        return latitude;%0A    %7D%0A%0A    public void setLatitude(double latitude) %7B%0A        this.latitude = latitude;%0A    %7D%0A%0A
     public Strin

add attribute to keep track of last recent location of participant