package cgeo.geocaching.connector.trackable;

import cgeo.geocaching.AbstractLoggingActivity;
import cgeo.geocaching.Trackable;
import cgeo.geocaching.TrackableLog;
import cgeo.geocaching.connector.UserAction;

import org.eclipse.jdt.annotation.NonNull;
import org.eclipse.jdt.annotation.Nullable;

import rx.Observable;

import java.util.List;

/**
 * Methods to be implemented by any connector for handling trackables
 *
 */
public interface TrackableConnector {

    /**
     * Return the preference activity for which the connector is attached to.
     * The service could be launched to ask user to configure something.
     *
     * @return the service ID corresponding to the preference activity for the connector
     */
    public int getPreferenceActivity();

    public boolean canHandleTrackable(final String geocode);

    public boolean canHandleTrackable(final String geocode, final TrackableBrand brand);

    /**
     * Return the Title of the service the connector is attached to.
     * Title may be used in messages given to the user, like to say which connector need to
     * be activated for a specific feature.
     *
     * @return the service TITLE corresponding to this connector
     */
    @NonNull
    public String getServiceTitle();

    /**
     * Check whether the connector has URLs corresponding the the trackable.
     *
     * @return <tt>true</tt> if the connector handles URLs, <tt>false</tt> otherwise
     */
    public boolean hasTrackableUrls();

    /**
     * Return the URL for a trackable. Might throw {@link IllegalStateException} if called
     * on a connector which does not have URLs for trackables. This might be checked using
     * {@link #hasTrackableUrls()}.
     *
     * @param trackable the trackable
     * @return the URL corresponding to this trackable
     */
    @NonNull
    public String getUrl(@NonNull final Trackable trackable);

    /**
     * Tell if the trackable has logging capabilities.
     *
     * @return True if trackable is loggable.
     */
    public boolean isLoggable();

    /**
     * Return a Trackable corresponding to the Tracable Geocode (Tracking Code) or Guid.
     * Note: Only GC conenctor support guid.
     *
     * @param geocode the trackable Tracking Code
     * @param guid the trackable guid
     * @param id the trackable id
     * @return the Trackable object.
     */
    @Nullable
    public Trackable searchTrackable(final String geocode, final String guid, final String id);

    /**
     * Return a Trackable corresponding to the Tracable Geocode.
     *
     * @param geocode the trackable
     * @return the Trackable object.
     */
    @NonNull
    public List<Trackable> searchTrackables(final String geocode);

    /**
     * Return a Trackable id from an url.
     *
     * @param url for one trackable
     * @return the Trackable Geocode.
     */
    @Nullable
    public String getTrackableCodeFromUrl(final @NonNull String url);

    /**
     * Return available user actions for the trackable.
     *
     * @return the List of available user action.
     */
    @NonNull
    public List<UserAction> getUserActions();

    /**
     * Return the Brand object for the Trackable.
     * If Brand could not be defined, return UNKNOWN_BRAND
     *
     * @return the Trackable Brand object.
     */
    @NonNull
    public TrackableBrand getBrand();

    /**
     * Return a list of Trackable in user's inventory.
     * In most case, user must be connected to the service.
     *
     * @return the Trackable list.
     */
    @NonNull
    public List<Trackable> loadInventory();

    /**
     * Return the Trackable Logging Manager for the Trackable.
     *
     * @param activity currently running
     * @return the Trackable logging manager.
     */
    @Nullable
    public AbstractTrackableLoggingManager getTrackableLoggingManager(final AbstractLoggingActivity activity);

    /**
     * Tell if the trackable is loggable via a generic Trackable Connector.
     *
     * @return True if Trackable is loggable via a generic Trackable Connector.
     */
    boolean isGenericLoggable();

    /**
     * Tell if the connector for this trackable is active.
     *
     * @return True if connector is active.
     */
    boolean isActive();

    /**
     * Tell if user is registered to the connector for this trackable.
     *
     * @return True if user is connected to service.
     */
    public boolean isRegistered();

    /**
     * Tell if the connector recommend logging a Trackable with Geocode.
     *
     * @return True if connector recommend Geocode.
     */
    public boolean recommendLogWithGeocode();

    public int getTrackableLoggingManagerLoaderId();

    /**
     * Return list of Trackables in user's inventory converted to TrackableLog object.
     * TrackableLog are used for posting a Trackable Log, they contains necessary
     * informations to post the Trackable Log.
     *
     * @return the TrackableLog corresponding to trackables in user's inventory as Observable.
     */
    @NonNull
    public Observable<TrackableLog> trackableLogInventory();
}

@@ -722,31 +722,24 @@
      */%0A    
-public 
 int getPrefe
@@ -752,39 +752,32 @@
 ctivity();%0A%0A    
-public 
 boolean canHandl
@@ -779,32 +779,42 @@
 HandleTrackable(
+@Nullable 
 final String geo
@@ -821,31 +821,24 @@
 code);%0A%0A    
-public 
 boolean canH
@@ -844,32 +844,42 @@
 HandleTrackable(
+@Nullable 
 final String geo
@@ -879,24 +879,34 @@
 ing geocode,
+ @Nullable
  final Track
@@ -1226,39 +1226,32 @@
    @NonNull%0A    
-public 
 String getServic
@@ -1442,39 +1442,32 @@
 ise%0A     */%0A    
-public 
 boolean hasTrack
@@ -1826,31 +1826,24 @@
 NonNull%0A    
-public 
 String getUr
@@ -2002,39 +2002,32 @@
 le.%0A     */%0A    
-public 
 boolean isLoggab
@@ -2363,31 +2363,24 @@
 ullable%0A    
-public 
 Trackable se
@@ -2623,39 +2623,32 @@
    @NonNull%0A    
-public 
 List%3CTrackable%3E 
@@ -2845,23 +2845,16 @@
 ble%0A    
-public 
 String g
@@ -3047,31 +3047,24 @@
 NonNull%0A    
-public 
 List%3CUserAct
@@ -3279,23 +3279,16 @@
 ull%0A    
-public 
 Trackabl
@@ -3497,23 +3497,16 @@
 ull%0A    
-public 
 List%3CTra
@@ -3722,23 +3722,16 @@
 ble%0A    
-public 
 Abstract
@@ -4330,39 +4330,32 @@
 ce.%0A     */%0A    
-public 
 boolean isRegist
@@ -4515,23 +4515,16 @@
  */%0A    
-public 
 boolean 
@@ -4555,23 +4555,16 @@
 );%0A%0A    
-public 
 int getT
@@ -4949,23 +4949,16 @@
 ull%0A    
-public 
 Observab

Remove redundant 'public' Modifier for interface methods