// Shape returned by /api/audit — matches AuditEvent on platform-api.

export type AuditOutcome = 'success' | 'failure'
export type AuditSource = 'platform-api' | 'operator-ui' | 'portal' | 'authentik' | 'ocis' | 'stalwart'
export type AuditResourceType = 'tenant' | 'partner' | 'user' | 'flag' | 'subscription' | 'system'

export interface AuditEvent {
  _id: string
  at: string  // ISO timestamp
  actorType: 'user' | 'system'
  actorId?: string
  actorEmail?: string
  actorIp?: string
  action: string
  outcome: AuditOutcome
  resourceType?: AuditResourceType
  resourceId?: string
  resourceName?: string
  tenantSlug?: string
  partnerSlug?: string
  source: AuditSource
  metadata?: Record<string, unknown>
  recordedAt?: string
}
