package cn.citycraft.AuthMe.datasource;

import java.util.List;

import cn.citycraft.AuthMe.cache.auth.PlayerAuth;

public interface DataSource {

	List<String> autoPurgeDatabase(long until);

	void close();

	int getAccountsRegistered();

	List<PlayerAuth> getAllAuths();

	List<String> getAllAuthsByEmail(String email);

	List<String> getAllAuthsByIp(String ip);

	List<String> getAllAuthsByName(PlayerAuth auth);

	PlayerAuth getAuth(String user);

	int getIps(String ip);

	List<PlayerAuth> getLoggedPlayers();

	DataSourceType getType();

	boolean isAuthAvailable(String user);

	boolean isLogged(String user);

	void purgeBanned(List<String> banned);

	int purgeDatabase(long until);

	void purgeLogged();

	void reload();

	boolean removeAuth(String user);

	boolean saveAuth(PlayerAuth auth);

	void setLogged(String user);

	void setUnlogged(String user);

	boolean updateEmail(PlayerAuth auth);

	void updateName(String oldone, String newone);

	boolean updatePassword(PlayerAuth auth);

	boolean updateQuitLoc(PlayerAuth auth);

	boolean updateSalt(PlayerAuth auth);

	boolean updateSession(PlayerAuth auth);

	enum DataSourceType {
		FILE,
		MYSQL,
		SQLITE,
		SQLITEHIKARI
	}

}
