export interface Attachment {
  id: string
  fileName: string
  fileType: string
  fileSize?: number
  url?: string
  generated?: boolean
}

export interface InquiryMessage {
  id: string
  inquiryId: string
  senderType: 'tenant' | 'supply_user' | 'system' | 'ai'
  senderName: string
  subject?: string
  body: string
  attachments: Attachment[]
  createdAt: string
}

export type InquiryStatus = 'new' | 'in_progress' | 'answered' | 'archived'

/** Konversationstyp: Nachfrager-initiierte Anfrage vs. Verwaltung-initiiertes Angebot. */
export type InquiryKind = 'INQUIRY' | 'OFFER'

export interface Inquiry {
  id: string
  /** Supply-Organisation (Eigentümer/Verwaltung des Objekts). */
  organizationId: string
  /** Nachfrager-Organisation — für das Demand-Postfach. */
  tenantOrgId?: string
  /** INQUIRY (Demand→Supply) oder OFFER (Supply→Demand). Default INQUIRY. */
  kind?: InquiryKind
  propertyId: string
  /** Bei OFFER: alle im Angebot enthaltenen Objekte. */
  offeredPropertyIds?: string[]
  needId?: string
  tenantName: string
  tenantCompany?: string
  tenantEmail?: string
  propertyManagerName?: string
  propertyManagerCompany?: string
  propertyAddress?: string
  subject: string
  message: string
  status?: InquiryStatus
  unreadCount: number
  isRead: boolean
  lastReadAt?: string
  matchScore?: number
  createdAt: string
  updatedAt: string
  thread: InquiryMessage[]
}
