package buffsftw.skatespots;

/**
 * Created by Jack on 11/16/2016.
 */

public class WebRequest {

    public int getUserId(String userEMail) {
        int userID = 0;

        return userID;
    }

    public String getPassword(String userEMail) {
        String password = "0";

        /*
        SELECT user_password FROM users WHERE user_email = userEMail;
        */

        /* Jack */

        return password;
    }


    public String getName(int userID) {
        String name = "0";

        /*
         SELECT user_first_name FROM users WHERE user_id = userID;
         */

        /* Jack */

        return name;
    }


    public String getUserName(int userID) {
        String userName = "0";

       /*
       SELECT user_name FROM users WHERE user_id = userID;
       */

        /* Jack */

        return userName;
    }


    public int[] getSpotCollection(int userID) {
        int[] spotCollection = new int[]{};

        /*
         SELECT spot_id FROM user_spot_collection WHERE user_id = userID;
         */

         /* Jack */

        return spotCollection;
    }


    public int getTokenCount(int userID) {
        int tokenCount = 0;

        /*
        SELECT token_count FROM users WHERE user_id = userID;
        */

        /* Jack */

        return tokenCount;
    }


    public void setPassword(String password, int userID) {

        /*
        UPDATE users SET user_password = 'NEWPASSWORD' where user_id = userID;
        */

        /* Jack */
    }


    public void setName(String name, int userID) {
        /*
        UPDATE users SET user_first_name = 'NEWNAME' WHERE user_id = userID;
        */

        /* Jack */
    }


    public void setUserName(String userName, int userID) {
        /*
        UPDATE users SET user_name = 'NEWUSERNAME' WHERE user_id = userID;
        */


       /* Jack */
    }


    public void setTokenCount(int tokenCount, int userID) {
        /*
        UPDATE users SET token_count = tokenCount WHERE user_id = userID;
       */

       /* Jack */
    }


    public void addSpot(int spotID, double xCoordinate, double yCordinate, String country, String city, String state, String spotType, char spotDifficulty, int userID) {
        /*
        INSERT INTO spots VALUES (spotID, xCoordinate, yCordinate, country, city, state, spotType, spotDifficulty);
        INSERT INTO spot_stats VALUES (0, 0, 1, 0, 0, 0);
        INSERT INTO user_spot_collection VALUES (userID, spotID);
        INSERT INTO user_spot_contribution VALUES (userID, spotID);
         */


        /* Jack */
    }


    public void addUser(int userID, String userName, String userFirstName, String userPassword, String userEMail, int userRating, int tokenCount) {
        /*
        WARNING: Needs tested in database
        INSERT INTO users VALUES (userID, userName, userFirstName, userPassword, userEmail, userRating, tokenCount);
        */

       /* Jack */


    }


}



@@ -1081,32 +1081,331 @@
 lection;%0A    %7D%0A%0A
+    public void getNewSpot(int userID) %7B%0A%0A        /*%0A        SELECT *%0A        FROM spots%0A       WHERE spots.spot_id NOT IN (SELECT spot_id from user_spot_collection where user_id = 2)%0A%0A         /* Jack*/%0A%0A        //SkateSpots.Spots newSpot = new SkateSpots.Spots();%0A        //return newSpot;%0A    %7D%0A%0A
 %0A    public int 
@@ -2362,20 +2362,8 @@
 pot(
-int spotID, 
 doub
@@ -2384,24 +2384,25 @@
 , double yCo
+o
 rdinate, Str
@@ -2530,24 +2530,103 @@
 O spots 
+(x_coordinate, y_coordinate, country, city, state, spot_type, spot_difficulty) 
 VALUES (
 spotID, 
@@ -2621,16 +2621,8 @@
 ES (
-spotID, 
 xCoo
@@ -2734,162 +2734,458 @@
 ES (
-0, 0, 1, 0, 0, 0);%0A        INSERT INTO user_spot_collection VALUES (userID, spotID);%0A        INSERT INTO user_spot_contribution VALUES (userID, spotID
+(SELECT spot_id FROM spots WHERE spots.x_coordinate = xCoordinate AND spots.y_coordinate = yCoordinate) , 0, 1, 0, 0, 0);%0A        INSERT INTO user_spot_collection VALUES (userID, (SELECT spot_id FROM spots WHERE spots.x_coordinate = xCoordinate AND spots.y_coordinate = yCoordinate));%0A        INSERT INTO user_spot_contribution VALUES (userID, (SELECT spot_id FROM spots WHERE spots.x_coordinate = xCoordinate AND spots.y_coordinate = yCoordinate)
 );%0A
- 
     
@@ -3248,20 +3248,8 @@
 ser(
-int userID, 
 Stri
@@ -3379,67 +3379,107 @@
     
-WARNING: Needs tested in database%0A        INSERT INTO users
+INSERT INTO users (user_name, user_first_name, user_password, user_email, user_rating, token_count)
  VAL
@@ -3483,24 +3483,16 @@
 VALUES (
-userID, 
 userName
@@ -3561,33 +3561,32 @@
 nt);%0A        */%0A
-%0A
        /* Jack *

Add sql comments for query to make new users, spots, and get a new spot.