export type tabKeyType = 'dynamic' | 'friends' | 'messages';
export interface TagType {
  key: string;
  label: string;
}

export type GeographicType = {
  province: {
    label: string;
    key: string;
  };
  city: {
    label: string;
    key: string;
  };
};

export type NoticeType = {
  id: string;
  title: string;
  logo: string;
  description: string;
  updatedAt: string;
  member: string;
  href: string;
  memberLink: string;
};

export type CurrentUser = {
  nickname: ReactNode;
  description: ReactNode;
  location: string;
  name: string;
  avatar: string;
  userid: string;
  notice: NoticeType[];
  email: string;
  signature: string;
  title: string;
  group: string;
  tags: string;
  notifyCount: number;
  unreadCount: number;
  country: string;
  geographic: GeographicType;
  address: string;
  phone: string;
};
export type UserInfo = {
  nickname: string;
  description: string;
  location: string;
  username: string;
  avatar: string;
  userId: string,
  email: string;
  tags: string;
  address: string;
  phone: string;
}
export interface FriendUser extends UserInfo  {
  createFriendTime: string;
  remark: string;
  friendStatus: string;
}

export type Member = {
  avatar: string;
  name: string;
  id: string;
};

export type ListItemDataType = {
  id: string;
  owner: string;
  title: string;
  avatar: string;
  cover: string;
  status: 'normal' | 'exception' | 'active' | 'success';
  percent: number;
  logo: string;
  href: string;
  body?: any;
  updatedAt: number;
  createdAt: number;
  subDescription: string;
  description: string;
  activeUser: number;
  newUser: number;
  star: number;
  like: number;
  message: number;
  content: string;
  members: Member[];
};

// 后端历史消息原始结构
export interface HistoryMessage {
  id: number;
  category: string; // 如 friend
  type: string; // 如 friend_accept, friend_request, chat 等
  fromUserId: string;
  toUserId: string;
  title: string;
  content: string | null;
  timestamp: number;
  status: string; // 如 unread, read
}

// 前端用于展示的消息结构
export type MessageItem =
  | {
      id: string;
      type: 'friend_request';
      category: string;
      senderId: string;
      senderName: string;
      content: string;
      status?: 'pending' | 'accepted' | 'rejected';
      toUserId: string;
    }
  | {
      id: string;
      type: 'friend_message';
      category: string;
      senderId: string;
      senderName: string;
      content: string;
      status?: 'read';
      toUserId: string;
    };

export interface WebSocketMessage {
  type: 'chat' | 'system' | 'notification' | 'friend' | 'error';
  content?: string;
  sender?: string;
  title?: string;
  timestamp?: Date;
  [key: string]: any; // 允许其他属性
}