@namespace("chat.1")

protocol NotifyChat {

  import idl "github.com/keybase/client/go/protocol/keybase1" as keybase1;

  enum ChatActivityType {
    RESERVED_0,
    INCOMING_MESSAGE_1,
    READ_MESSAGE_2,
    NEW_CONVERSATION_3,
    SET_STATUS_4,
    FAILED_MESSAGE_5
  } 

  record IncomingMessage {
    MessageUnboxed message;
    ConversationID convID;
    union { null, ConversationLocal } conv;
    union { null, Pagination } pagination;
  }

  record ReadMessageInfo {
    ConversationID convID;
    MessageID msgID;
    union { null, ConversationLocal } conv;
  }

  record NewConversationInfo {
    ConversationLocal conv;
  }

  record SetStatusInfo {
    ConversationID convID;
    ConversationStatus status;
    union { null, ConversationLocal } conv;
  }

  record FailedMessageInfo {
    array<OutboxRecord> outboxRecords;
  }

  variant ChatActivity switch (ChatActivityType activityType) {
    case INCOMING_MESSAGE: IncomingMessage;
    case READ_MESSAGE: ReadMessageInfo;
    case NEW_CONVERSATION: NewConversationInfo;
    case SET_STATUS: SetStatusInfo;
    case FAILED_MESSAGE: FailedMessageInfo;
  }
  

  @notify("")
  @lint("ignore")
  void NewChatActivity(keybase1.UID uid, ChatActivity activity);

  @notify("")
  @lint("ignore")
  void ChatIdentifyUpdate(keybase1.CanonicalTLFNameAndIDWithBreaks update);

  @notify("")
  @lint("ignore")
  void ChatTLFFinalize(keybase1.UID uid, ConversationID convID, ConversationFinalizeInfo finalizeInfo,
    union { null, ConversationLocal } conv);

  @notify("")
  @lint("ignore")
  void ChatTLFResolve(keybase1.UID uid, ConversationID convID, ConversationResolveInfo resolveInfo);

  @notify("")
  @lint("ignore") 
  void ChatInboxStale(keybase1.UID uid);

  @notify("")
  @lint("ignore")
  void ChatThreadsStale(keybase1.UID uid, array<ConversationID> convIDs);
}
