import type TIM_MODULE from 'tim-js-sdk';
import type { ChatSDK } from 'tim-js-sdk';

export type TimType = typeof TIM_MODULE;
export type TimInstanceType = ChatSDK & MyChatSDK;

export interface UpdateMyProfileOptions {
  nick?: string;
  avatar?: string;
}

export interface MyChatSDK {
  isOnline?: boolean
  isReady?: boolean

  userId?: string;
  userSig?: string;

  updateUserId?: (userId: string) => void;
  updateUserSig?: (userSig: string) => void;

  updateOnlineStatus?: (status: boolean) => void;
  updateReadyStatus?: (status: boolean) => void;

  // deleteConversation: Function;
  // setAllMessageRead: Function;
  // setMessageRead: Function;
  // updateMyProfile: Function;
  // getConversationList: Function;
  // logout: Function
  // login: Function

  // on: Function;
  // setLogLevel: Function;
  // getMessageList: Function;
}

export type EventCallback = (event: Event, tim: TimInstanceType) => void;


declare global {
  interface Window {
    TIM: TimType;
  }
}
