// Read state management types

import type { FeedViewType } from "@folo-services/constants"

import type { SuccessResponse } from "../../types"

/**
 * Query parameters for getting read status
 */
export interface ReadStatusQuery {
  view?: FeedViewType
}

export type ReadStatusResponse = SuccessResponse<Record<string, number>> // feedId/inboxId -> unread count

/**
 * Request to mark entries as read
 */
export interface MarkAsReadRequest {
  entryIds: string[]
  isInbox?: boolean
  readHistories?: string[]
}

/**
 * Request to mark single entry as unread
 */
export interface MarkAsUnreadRequest {
  entryId: string
  isInbox?: boolean
}

/**
 * Request to mark all entries as read (batch operation)
 */
export interface MarkAllAsReadRequest {
  view?: number
  feedId?: string
  listId?: string
  inboxId?: string
  feedIdList?: string[]
  startTime?: number
  endTime?: number
  excludePrivate?: boolean
  insertedBefore?: number // Useful when you don't want to mark newly inserted content that has not yet been rendered by the front end
}

/**
 * Response for mark all as read operation
 */
export type MarkAllAsReadResponse = SuccessResponse<{
  read: Record<string, number> // feedId -> number of entries marked as read
}>

/**
 * Response for basic read operations
 */
export type ReadOperationResponse = SuccessResponse<null>

/**
 * Response for total unread count
 */
export type TotalUnreadCountResponse = SuccessResponse<{
  count: number
}>
