package tw.edu.ncu.cc.manage.service;

import java.io.IOException;
import java.net.MalformedURLException;
import java.util.List;
import java.util.Optional;

import com.fasterxml.jackson.core.JsonParseException;
import com.fasterxml.jackson.databind.JsonMappingException;

import tw.edu.ncu.cc.manage.entity.oauth.application.Application;
import tw.edu.ncu.cc.manage.entity.oauth.application.IdApplication;
import tw.edu.ncu.cc.manage.entity.oauth.application.SecretIdApplication;
import tw.edu.ncu.cc.manage.service.oauth.exception.OAuthConnectionException;

public interface IApplicationService {
	public static final String SERVICE_URL = "https://api.cc.ncu.edu.tw/oauth/management/v1/application/";
	public static final String USER_SERVICE_URL = "https://api.cc.ncu.edu.tw/oauth/management/v1/user/";

	boolean isAllowToAccess(Application application, String userid);

	List<IdApplication> findAll(String username) throws IOException;

	Optional<IdApplication> findById(String id) throws MalformedURLException, IOException;

	Optional<IdApplication> update(IdApplication application) throws OAuthConnectionException, IOException;

	void remove(IdApplication application) throws IOException, OAuthConnectionException;

	Optional<IdApplication> create(Application application) throws OAuthConnectionException, JsonParseException, JsonMappingException, MalformedURLException, IOException;

	Optional<SecretIdApplication> refreshSecret(String applicationId) throws MalformedURLException, IOException, OAuthConnectionException;
}

@@ -594,214 +594,8 @@
 ce %7B
-%0A%09public static final String SERVICE_URL = %22https://api.cc.ncu.edu.tw/oauth/management/v1/application/%22;%0A%09public static final String USER_SERVICE_URL = %22https://api.cc.ncu.edu.tw/oauth/management/v1/user/%22;
 %0A%0A%09b

remove duplicate OAuth url