export type AuditEvent = {
  actorId?: string | null
  actorType?: string | null
  actorLabel?: string | null
  action: string
  entityType: string
  entityId: string
  metadata?: Record<string, unknown> | null
  ip?: string | null
  tenantId?: string | null
}

export type LogAuditResult = {
  logged: boolean
  id?: string
  error?: unknown
}

export type AuditRecord = {
  id: string
  actorId: string | null
  actorType: string | null
  actorLabel: string | null
  action: string
  entityType: string
  entityId: string
  metadata: Record<string, unknown> | null
  ip: string | null
  tenantId: string | null
  createdAt: Date
}

export type ListAuditFilter = {
  tenant?: string
  actor?: string
  entityType?: string
  entityId?: string
  action?: string
  from?: Date
  to?: Date
  q?: string
  limit?: number
  cursor?: string
}

export type ListAuditResult = {
  items: AuditRecord[]
  nextCursor: string | null
}

export type AuditCursor = {
  createdAt: string
  id: string
}
