export type Json = string | number | boolean | null | Json[] | { [key: string]: Json }

export type AdminRole =
  | 'admin'
  | 'moderator'
  | 'support'
  | 'partner_manager'
  | 'content_manager'

export type AdminStatus = 'active' | 'disabled' | 'invited'

export type PermissionKey =
  | 'dashboard.read'
  | 'users.read'
  | 'users.write'
  | 'routes.read'
  | 'routes.moderate'
  | 'trips.read'
  | 'services.read'
  | 'services.write'
  | 'maintenance.read'
  | 'maintenance.write'
  | 'checklists.read'
  | 'checklists.write'
  | 'rewards.read'
  | 'rewards.write'
  | 'missions.read'
  | 'missions.write'
  | 'notifications.read'
  | 'notifications.write'
  | 'reports.read'
  | 'reports.moderate'
  | 'settings.read'
  | 'settings.write'
  | 'analytics.read'
  | 'support.read'
  | 'support.write'
  | 'partners.read'
  | 'partners.write'
  | 'admins.manage'
  | 'audit.read'

export interface AdminUser {
  id: string
  user_id: string
  role_key: AdminRole
  display_name: string | null
  email: string
  status: AdminStatus
  last_seen_at: string | null
  created_at: string
  updated_at: string
}

export interface CurrentAdmin {
  userId: string
  email: string
  admin: AdminUser
  permissions: PermissionKey[]
}

export interface AdminAuditLogInput {
  action: string
  entityType: string
  entityId?: string | null
  oldValues?: Json
  newValues?: Json
}

export type ReportStatus = 'pending' | 'reviewed' | 'dismissed' | 'actioned'
export type ModerationStatus = 'pending' | 'approved' | 'rejected'
export type CampaignStatus = 'draft' | 'scheduled' | 'sent' | 'failed' | 'cancelled'
export type PartnerStatus = 'prospect' | 'contacted' | 'negotiating' | 'active' | 'paused' | 'cancelled'
