package com.kamontat.constant;

import com.kamontat.model.Repositories;
import com.kamontat.model.User;

/**
 * @author kamontat
 * @version 5
 * @since 1/26/2017 AD - 2:11 PM
 */
public enum RequestStatus {
	COMPLETE("Download complete!"),
	EMPTY("Empty issue."),
	README_NOT_FOUND("Readme not found."),
	
	FILE_ERROR("Cannot create csv file!"),
	REPO_NOT_FOUND("Repositories not found."),
	USER_ERROR("Cannot get information from User"),
	USER_EMAIL_NOT_FOUND("your token cannot access to email"),
	
	INTERNET_ERROR("4xx/5xx http-status-code"),
	LIMIT_EXCEED("Rate limit exceed."),
	USER_NOT_FOUND("Username not found."),
	GITHUB_ERROR("Cannot connect git"),
	ERROR("An Exception has occurred!");
	
	private String description;
	
	RequestStatus(String description) {
		this.description = description;
	}
	
	public String getFullDescription(User user, Repositories.Repository repository) {
		if (repository == null) return getFullDescription(user, "-");
		return String.format("%s (%s) %s", user.fullname, repository.name, description);
	}
	
	public String getFullDescription(User user, String repoName) {
		if (user == null) return getFullDescription("-", repoName);
		return getFullDescription(user.fullname, repoName);
	}
	
	public String getFullDescription(String username, String repoName) {
		if (username == null) {
			return String.format("%s", description);
		} else if (repoName == null) {
			return String.format("%s %s", username, description);
		}
		return String.format("%s (%s) %s", username, repoName, description);
	}
	
	@Override
	public String toString() {
		return description;
	}
}

@@ -305,43 +305,43 @@
 %0A%09%0A%09
-FILE_ERROR(%22Cannot create csv file!
+USER_NOT_FOUND(%22Username not found.
 %22),%0A
@@ -385,20 +385,66 @@
 nd.%22),%0A%09
-USER
+%0A%09FILE_ERROR(%22Cannot create csv file!%22),%0A%09USER_GET
 _ERROR(%22
@@ -495,213 +495,309 @@
 AIL_
-NOT_FOUND(%22your token cannot access to email%22),%0A%09%0A%09INTERNET_ERROR(%224xx/5xx http-status-code%22),%0A%09LIMIT_EXCEED(%22Rate limit exceed.%22),%0A%09USER_NOT_FOUND(%22Username not found.%22),%0A%09GITHUB_ERROR(%22Cannot connect git
+ERROR(%22Cannot access to email by your token%22),%0A%09REPO_ERROR(%22Cannot get Repository%22),%0A%09ISSUE_ERROR(%22Cannot get issue information%22),%0A%09MYSELF_ERROR(%22Cannot get information from Myself%22),%0A%09INTERNET_ERROR(%224xx/5xx http-status-code%22),%0A%09GITHUB_ERROR(%22Cannot connect git%22),%0A%09%0A%09LIMIT_EXCEED(%22Rate limit exceed.
 %22),%0A

add more constant