import type { Database } from '../../supabase/database.types'

// Import Supabase-generated types (don't recreate!)
export type NotificationRow = Database['public']['Tables']['notifications']['Row']
export type NotificationInsert = Database['public']['Tables']['notifications']['Insert']
export type NotificationUpdate = Database['public']['Tables']['notifications']['Update']

// Only create types for business logic transformations
export interface Notification {
  id: string
  userId: string // Transformed from user_id
  organizationId: string // Transformed from organization_id
  category: NotificationRow['category']
  title: string
  message: string
  actionUrl: string | null // Transformed from action_url
  read: boolean
  readAt: Date | null // Transformed from read_at
  createdAt: Date // Transformed from created_at
}

export interface CreateNotificationParams {
  userId: string
  organizationId: string
  category: NotificationRow['category']
  title: string
  message: string
  actionUrl?: string
}

/**
 * Wire-format DTO for notification API responses.
 * Dates are ISO 8601 strings (not Date objects like the domain Notification type).
 * Used by frontend hooks that consume /api/notifications.
 */
export interface NotificationDTO {
  id: string
  userId: string
  organizationId: string
  category: string
  title: string
  message: string
  actionUrl: string | null
  read: boolean
  readAt: string | null
  createdAt: string
}
