import java.util.*;
import java.util.regex.*;

/*
 * Definition of Protocol for Music Sharing System
 * including message creation and parsing functions
 */
 
public class Protocol {

	/*
	 * Protocol codes
	 */
	 public static final int RSUCCESS = 100;
     public static final int RNOTLOGGEDIN = 900;
     public static final int RALREADYLOGGEDIN = 901;
     public static final int RINVALIDMSG = 910;
     public static final int RINVALIDARGS = 911;
     public static final int RNOTFOUND = 920;

	/*
	 * Protocol message building functions
	 * ADD YOUR CODE and use the functions in Client and Server classes
	 */
	public static String createLoginRequest(String userName) {
		return "LOGIN <"+userName+">";
	}

	public static String createLogoutRequest() {
		/* your code here */
		
	}

	public static String createPostRequest(String genre, String title, String clip, int clipSize, String url, String date) {
		/* your code here */

	}

	public static String createListRequest(String genre) {
		/* your code here */

	}

	public static String createScoreRequest(String genre, String id, int score) {
		/* your code here */

	}

	public static String createClipRequest(String clipName) {
		/* your code here */

	}

	public static String createSimpleResponse(int code) {
		return String.valueOf(code);
	}

	public static String createListResponse(int code, List<MusicRecord> aList) {
		/* your code here */

	}

	public static String createClipResponse(int code, int clipSize) {
		/* your code here */

	}

	/*
	 * Protocol message parsing
	 * ADD YOUR CODE and use the functions in Client and Server classes
	 */
	public static String getRequestCmd(String message) {
		String m = message.trim();
		if (m.indexOf(' ') == -1)
			return m;
		else 
			return m.substring(0, m.indexOf(' '));
	}

	public static String[] getRequestArgs(String message) {
		/* your code here */

	}

	public static int getResponseCode(String message) {
		/* your code here */

	}

	public static String[] getResponseArgs(String message) {
		/* your code here */

	}
}
