/**
 * Task communications wire types — tasks-detail-communication.
 *
 * Wire shapes for task messages/attachments. The real-time event contract lives
 * in @zync/realtime (transport owned by real-time-infrastructure).
 */
import type { NotificationType } from './notification-type'

// ── Serialized notification shape (minimal, for wire transport) ───────────────

export interface WireNotification {
  id: string
  userId: string
  tenantId: string
  type: NotificationType
  titleKey: string
  bodyKey: string
  params: Record<string, unknown>
  entityType: string | null
  entityId: string | null
  readAt: string | null
  createdAt: string
}

// ── Task message attachment (wire shape; r2_key NOT exposed) ──────────────────

export interface TaskMessageAttachment {
  id: string
  filename: string
  url: string
  sizeBytes: number
  mimeType: string
  createdAt: string
}

// ── Task message (wire shape) ─────────────────────────────────────────────────

export interface TaskMessage {
  id: string
  taskId: string
  authorId: string | null
  authorName: string | null
  authorAvatarUrl: string | null
  messageType: 'comment' | 'system'
  /** sanitized HTML (comment) or plain text (system message) */
  content: string
  deleted: boolean
  attachments: TaskMessageAttachment[]
  createdAt: string
}

// Real-time event contract lives in @zync/realtime (enveloped RealtimeEvent +
// RealtimeEventType). Transport ownership: real-time-infrastructure. This module
// only contributes the `task.updated` / `task.message_added` members + payloads.
