/*
 * 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 "nsIRDFDataSource.idl"
#include "nsIRDFRemoteDataSource.idl"
#include "nsIDOMNode.idl"
#include "nsISimpleEnumerator.idl"
#include "nsIDictionary.idl"
#include "nsIDOMDocument.idl"
#include "flockIError.idl"
#include "flockIPoller.idl"
#include "nsIWritablePropertyBag2.idl"


///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////

interface flockIMediaWebService;
interface flockIMediaItem;

[scriptable, uuid(5b2aeb54-0955-46fc-b3d7-19b9593d099a)]
interface flockIPhotoUpload: nsISupports
{
  attribute string id;
  attribute string fileName;
  attribute string originalFileSpec;
  attribute string originalFilePath;
  attribute string workingFilePath;
  attribute string workingFileSpec;
  attribute string previewFileSpec;
  attribute string previewFilePath;
  attribute string thumbFileSpec;
  attribute string thumbFilePath;

  attribute AString title;
  attribute AString tags;
  attribute AString notes;
  attribute AString description;
  attribute AString privacy_use_batch;
  attribute string is_public;
  attribute string is_friend;
  attribute string is_family;

  attribute AString album;
  attribute string state;
  /*
   * states:
   *         (blank)
   *         uploading
   *         pending
   */
  attribute string rotation;
  attribute string crop;
};

[scriptable, uuid(03c80699-d437-466d-a9af-d28b4f3bc6e1)]
interface flockIPhotoUploadListener: nsISupports
{
  void onUploadProgress(in PRUint32 aCurrentProgress);
  void onCreatePhotoUpload(in flockIPhotoUpload aUpload);
  void onUploadStart(in flockIPhotoUpload aUpload, in long aCount, in long aMax);
  void onUpload(in flockIPhotoUpload aUpload, in long aCount, in long aMax);
  void onUploadError(in flockIPhotoUpload aUpload, in long aCount, in long aMax, in flockIError aError);
  void onUploadComplete();
  void onUploadAdd(in flockIPhotoUpload aUpload);
  void onUploadRemove();
  void onMediaImportError(in AString aFilename);
  void onError(in flockIError aError);
  void onMediaImportStart(in AString filename, in long aNumInBatch);
  void onMediaImportFinish(in flockIPhotoUpload aPhotoUpload, in long aCount);
  void onMediaBatchImportStart(in long aBatchSize);
  void onMediaBatchImportFinish();
};

[scriptable, uuid(2a470693-5a07-4a7a-bca9-3bf7b6841348)]
interface flockIPhotoUploadAPIListener: nsISupports
{
  void onProgress(in PRUint32 aCurrentProgress);
  void onUploadComplete(in flockIPhotoUpload aUpload);
  void onUploadFinalized(in flockIPhotoUpload aUpload,
                         in flockIMediaItem aMediaItem);
  void onError(in flockIError aError);
};

[scriptable, uuid(74a7c5a0-97d7-4ac0-8728-305e74849453)]
interface flockIPhotoUploadService: nsIRDFDataSource
{
  boolean hasOnePhotoAccount();
  string getDefaultService();
  void setDefaultService(in string aServiceId);
  void promptForAccount();
  void launchUploader();

  void importSingleMediaItem(in flockIPhotoUploadListener aListener, in AString aFileName);
  void addMediaToImportQueue(in AString aUrl, in flockIPhotoUploadListener aListener);
  void startImportQueue( in flockIPhotoUploadListener aListener);
  void cancelImport();

  void upload(in flockIMediaWebService aAPI);
  void singleUpload(in flockIPhotoUploadAPIListener aListener,
                    in flockIMediaWebService aAPI,
                    in flockIPhotoUpload aUpload);

  void cancelUpload();

  void addPhotoUpload(in flockIPhotoUpload aReference, in flockIPhotoUpload aUpload);
  void savePhotoUpload(in flockIPhotoUpload aUpload);
  void removePhotoUpload(in flockIPhotoUpload aUpload);
  void reorderPhotoUpload(in flockIPhotoUpload aReference, in flockIPhotoUpload aUpload);
  flockIPhotoUpload getPhotoUpload(in AString aURI);
  void addListener(in flockIPhotoUploadListener aListener);
  void removeListener(in flockIPhotoUploadListener aListener);
  void cropPhotoUpload(in flockIPhotoUpload aUpload, in double aX1, in double aY1, in double aX2, in double aY2);
  void revertPhotoUpload(in flockIPhotoUpload aUpload);
  void rotatePhotoUpload(in flockIPhotoUpload aUpload, in PRInt32 aDegrees);
  void save();// should go away
  void cleanPhotoUploadCache();

  readonly attribute boolean isUploading;
  readonly attribute boolean isImporting;
};
