/* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

#include "nsISupports.idl"

/**
 * Interface for a folder to get/set its values in the foldercache.
 */
[scriptable, uuid(c7392b12-f68a-46b2-af5e-d47350bb17c3)]
interface nsIMsgFolderCacheElement : nsISupports
{
  readonly attribute ACString key;
  // Notes on the getCached...() functions:
  // - They will fail if the property doesn't exist. That is, they'll
  //   throw an exception in JS, or return an NS_ERROR_* code in C++.
  // - null values are returned as empty string (for getCachedString()),
  //   or zero (for the numeric accessors). NOTE: there should be no
  //   way to actually set properties to null, but the
  //   panacea.dat->folderCache.json might have introduced some, so we
  //   need to handle them.
  // - On the C++ side there is legacy code which calls these functions
  //   without checking the error code and relies on the return value
  //   remaining unchanged if the function fails.
  AUTF8String getCachedString(in string propertyName);
  long getCachedInt32(in string propertyName);
  unsigned long getCachedUInt32(in string propertyName);
  long long getCachedInt64(in string propertyName);

  void setCachedString(in string propertyName, in AUTF8String propertyValue);
  void setCachedInt32(in string propertyName, in long propertyValue);
  void setCachedUInt32(in string propertyName, in unsigned long propertyValue);
  void setCachedInt64(in string propertyName, in long long propertyValue);
};
