import {
  DirectMessage,
  FriendRequest,
  Friendship,
  PlayerTravelUnlock,
  SocialNotification,
  UserBlock,
  UserReport,
} from './social.entities';

export const SOCIAL_STORE = 'SOCIAL_STORE';

export interface SocialStore {
  listFriendships(userId: bigint): Promise<Friendship[]>;
  findFriendship(userLowId: bigint, userHighId: bigint): Promise<Friendship | null>;
  createFriendship(userLowId: bigint, userHighId: bigint): Promise<Friendship>;
  deleteFriendship(userLowId: bigint, userHighId: bigint): Promise<void>;
  findPendingFriendRequest(requesterId: bigint, recipientId: bigint): Promise<FriendRequest | null>;
  createFriendRequest(requesterId: bigint, recipientId: bigint, expiresAt: Date): Promise<FriendRequest>;
  findFriendRequest(id: bigint): Promise<FriendRequest | null>;
  saveFriendRequest(request: FriendRequest): Promise<FriendRequest>;
  cancelPendingRequestsBetween(userA: bigint, userB: bigint): Promise<void>;
  listFriendRequests(userId: bigint): Promise<FriendRequest[]>;
  createBlock(userId: bigint, blockedUserId: bigint): Promise<UserBlock>;
  deleteBlock(userId: bigint, blockedUserId: bigint): Promise<void>;
  isBlocked(userId: bigint, blockedUserId: bigint): Promise<boolean>;
  listBlocks(userId: bigint): Promise<UserBlock[]>;
  createDirectMessage(input: Pick<DirectMessage, 'sender_id' | 'recipient_id' | 'content' | 'expires_at'>): Promise<DirectMessage>;
  listDirectMessages(userA: bigint, userB: bigint, limit: number, before?: Date): Promise<DirectMessage[]>;
  markDirectMessagesRead(readerId: bigint, otherUserId: bigint): Promise<number>;
  listConversations(userId: bigint): Promise<DirectMessage[]>;
  countUnreadDirectMessages(userId: bigint): Promise<number>;
  createReport(input: Pick<UserReport, 'reporter_id' | 'reported_user_id' | 'reason' | 'note' | 'message_id'>): Promise<UserReport>;
  createUnlock(userId: bigint, destinationId: string): Promise<PlayerTravelUnlock>;
  listUnlocks(userId: bigint): Promise<PlayerTravelUnlock[]>;
  createNotification(input: Pick<SocialNotification, 'user_id' | 'category' | 'title' | 'content' | 'action_metadata' | 'expires_at'>): Promise<SocialNotification>;
  listNotifications(userId: bigint, limit: number, before?: Date): Promise<SocialNotification[]>;
  markNotificationRead(userId: bigint, id: bigint): Promise<SocialNotification | null>;
  markAllNotificationsRead(userId: bigint): Promise<number>;
  countUnreadNotifications(userId: bigint): Promise<number>;
  purgeUsers(userIds: bigint[]): Promise<void>;
  cleanupExpired(now: Date): Promise<void>;
}
