/* vim: ts=4 sw=4 expandtab cindent
 *
 * BEGIN FLOCK GPL
 * 
 * Copyright Flock Inc. 2005-2006
 * http://flock.com
 * 
 * This file may be used under the terms of 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 "nsISimpleEnumerator.idl"
#include "flockIFavoriteProperties.idl"

[scriptable, uuid(a49efc44-ff1c-4cdb-b77e-82f4ef09e481)]
interface flockIFavoritesChange : nsISupports {
};

[scriptable, uuid(4ccb0a0f-f199-4a4a-b2b4-fd05101bc063)]
interface flockIFavoritesChangeFavorite : flockIFavoritesChange {
    /** the url of the favorite being changed */
    readonly attribute string url;

    /** the favorite is being deleted */
    readonly attribute boolean isDelete;

    /** the properties on the favorite */
    readonly attribute flockIFavoriteProperties properties;
};

[scriptable, uuid(494e61eb-b334-41d2-b8c7-5a1e1ecd2a03)]
interface flockIFavoritesChangeCollection : flockIFavoritesChange {
    /** the name of the collection being changed */
    readonly attribute AString name;

    /** the collection is being deleted */
    readonly attribute boolean isDelete;

    /** the contents of the collection - an enumeration of nsIRDFResource */
    readonly attribute nsISimpleEnumerator contents;
};

[scriptable, uuid(6c45a744-6d3a-4c36-9794-cad65b7efe71)]
interface flockIFavoritesQueue : nsISupports {
    const unsigned long DIRECTION_TO_WEB_SERVICE = 0;
    const unsigned long DIRECTION_FROM_WEB_SERVICE = 1;

    /* you must call this before using the queue */
    void init (in string aName);

    /* clear everything in the queue */
    void clear ();

    /* queue a favorite change */
    void changeFavorite (in string aURL, 
            in flockIFavoriteProperties aProperties, in boolean aDirection);

    /* queue a favorite deletion */
    void deleteFavorite (in string aURL, 
            in flockIFavoriteProperties aProperties, in boolean aDirection);

    /* queue a collection change */
    void changeCollection (in AString aName, in nsISimpleEnumerator aContents,
            in boolean aDirection);

    /* queue a collection deletion */
    void deleteCollection (in AString aName, in boolean aDirection);

    /* this will be called by either the web service of the favorites service
     * to get the next change to apply */
    flockIFavoritesChange nextChange (in boolean aDirection);

    /* are there changes pending for the given url */
    boolean changesPending (in string aURL);

    /* flush rdf to disk */
    void Flush ();
};
