/* 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"
#include "nsISimpleEnumerator.idl"
#include "nsIFile.idl"

interface imIAccount;
interface imIAccountBuddy;
interface imIBuddy;
interface imIContact;
interface prplIConversation;
interface prplIMessage;

[scriptable, uuid(5bc06f3b-33a1-412b-a4d8-4fc7ba4c962b)]
interface imILogConversation: nsISupports {
  readonly attribute AUTF8String title;
  readonly attribute AUTF8String name;

  // Simplified account implementation:
  //  - alias will always be empty
  //  - name (always the normalizedName)
  //  - statusInfo will return Services.core.globalUserStatus
  //  - protocol will only contain a "name" attribute, with the prpl's normalized name.
  // Other methods/attributes aren't implemented.
  readonly attribute imIAccount account;

  readonly attribute boolean isChat; // always false (compatibility with prplIConversation).
  readonly attribute imIAccountBuddy buddy; // always null (compatibility with prplIConvIM).

  void getMessages([optional] out unsigned long messageCount,
                   [retval, array, size_is(messageCount)] out prplIMessage messages);
};

[scriptable, uuid(164ff6c3-ca64-4880-b8f3-67eb1817955f)]
interface imILog: nsISupports {
  readonly attribute AUTF8String path;
  readonly attribute PRTime time;
  readonly attribute AUTF8String format;
  // Will return null if the log format isn't json.
  imILogConversation getConversation();
};

[scriptable, uuid(327ba58c-ee9c-4d1c-9216-fd505c45a3e0)]
interface imILogger: nsISupports {
  imILog getLogFromFile(in nsIFile aFile, [optional] in boolean aGroupByDay);
  nsIFile getLogFileForOngoingConversation(in prplIConversation aConversation);
  nsISimpleEnumerator getLogsForAccountBuddy(in imIAccountBuddy aAccountBuddy);
  nsISimpleEnumerator getLogsForBuddy(in imIBuddy aBuddy);
  nsISimpleEnumerator getLogsForContact(in imIContact aContact);
  nsISimpleEnumerator getLogsForConversation(in prplIConversation aConversation,
                                             [optional] in boolean aGroupByDay);
  nsISimpleEnumerator getSystemLogsForAccount(in imIAccount aAccount);
  nsISimpleEnumerator getSimilarLogs(in imILog aLog,
                                     [optional] in boolean aGroupByDay);
};
