/* vim: ts=4 sw=4 expandtab cindent
 *
 * BEGIN FLOCK GPL
 *
 * Copyright Flock Inc. 2005-2008
 * http://flock.com
 *
 * This file may be used under the terms of the
 * GNU General Public License Version 2 or later (the "GPL"),
 * http://www.gnu.org/licenses/gpl.html
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * END FLOCK GPL
 */

#include "nsISupports.idl"

#include "flockIFavoritesQueue.idl"
#include "nsISimpleEnumerator.idl"

[scriptable, uuid(b2112400-a390-48cc-8e72-b9dd022d4c8f)]
interface flockIFavoritesWebServiceFavoritesListener : nsISupports {
    void onFailed (in AString aMessage);
    // an nsISimpleEnumerator of flockIFavoritesChange
    void onSucceeded (in nsISimpleEnumerator aFavorites);
};


[scriptable, uuid(be79df44-bce0-4f19-a46b-dff2eea4c03d)]
interface flockIFavoritesWebServiceSyncRequiredListener : nsISupports {
    void onFailed (in AString aMessage);
    void onSucceeded (in boolean aSyncRequired);
};


[scriptable, uuid(c0ee65b2-1d7c-418e-a221-f95fbaf6caf8)]
interface flockIFavoritesWebServiceLoginListener: nsISupports {
    void onFailed (in AString aMessage);
    void onSucceeded ();
};


[scriptable, uuid(2d54da03-2d85-47ed-b80a-7739e8cf72b3)]
interface flockIFavoritesWebService : nsISupports {
    // set the queue to read from
    void setFavoritesQueue (in flockIFavoritesQueue aQueue);

    // get all favorites
    void getAllFavorites (in flockIFavoritesWebServiceFavoritesListener aListener);

    // get all collections
    void getAllCollections (in flockIFavoritesWebServiceFavoritesListener aListener);

    // do we need to sync?
    void getSyncRequired (in flockIFavoritesWebServiceSyncRequiredListener aListener);

    // log in information
    void login (in AString aUserName, in AString aPassword, in flockIFavoritesWebServiceLoginListener aListener);

    // the username and password currently set
    // XXX - I don't like this API and plan to change it. These will probably
    // turn into readonly attributes
    AString getUsername ();
    AString getPassword ();

    // this is called when the web service is disabled. the component 
    // should clear any state it has stored in prefs
    void serviceDisabled ();

    // get the url of a web view of the bookmarks
    readonly attribute AString webView;

    // get the url of a web page that users can sign up for accounts on
    readonly attribute AString signupPage;

    // a human-readable name
    readonly attribute AString name;

    // a longer description to use in the first-run wizard
    readonly attribute AString description;

    // id used in prefs to refer to this service in prefs
    readonly attribute string id;

    // which fields are supported and used by this favorites service
    readonly attribute unsigned long supportedFields;

    // is collections sync supported?
    readonly attribute boolean supportsCollections;

    // does the server return deletions?
    readonly attribute boolean supportsExplicitDeletes;

    // what version of the API is this?
    readonly attribute short version;
};


