/**
 * 私信模块类型定义
 *
 * 通知相关类型（NotificationType, Notification, NotificationPreferences,
 * UpdateNotificationPreferencesInput, CreateNotificationInput, GetNotificationsParams,
 * PaginatedResult）已迁移到 notifications/types.ts，请直接从该模块导入。
 */

export type MessageType = "inbox" | "sent" | "all"

export interface Message {
  id: string
  senderId: string
  senderName: string | null
  receiverId: string
  receiverName: string | null
  subject: string | null
  content: string
  isRead: boolean
  isStarred: boolean
  readAt: string | null
  parentMessageId: string | null
  createdAt: string
}

export type MessageListItem = Message

export interface MessageThread {
  messages: Message[]
}

export interface GetMessagesParams {
  userId: string
  type: MessageType
  page?: number
  pageSize?: number
  keyword?: string
  /** V2-P2-13c: 仅返回星标消息 */
  starredOnly?: boolean
}

export interface CreateMessageInput {
  senderId: string
  receiverId: string
  subject?: string | null
  content: string
  parentMessageId?: string | null
}

export interface RecipientOption {
  id: string
  name: string
  email: string
  role?: string
}

/** V2-P2-13c: 消息草稿 */
export interface MessageDraft {
  id: string
  userId: string
  receiverId: string | null
  receiverName: string | null
  subject: string | null
  content: string | null
  parentMessageId: string | null
  createdAt: string
  updatedAt: string
}

export interface CreateMessageDraftInput {
  userId: string
  receiverId?: string | null
  subject?: string | null
  content?: string | null
  parentMessageId?: string | null
}

export interface UpdateMessageDraftInput {
  receiverId?: string | null
  subject?: string | null
  content?: string | null
  parentMessageId?: string | null
}
