export type AdminRole = {
  id: string
  code: string
  name: string
  name_ar?: string
  name_en?: string
  description: string
  user_count: number
  is_privileged: boolean
  is_system?: boolean
  permissions?: PermissionItem[]
}

export type PermissionItem = {
  id: string
  code: string
  module: string
  name_ar: string
  name_en?: string | null
  description?: string | null
}

export type PermissionAction = "view" | "create" | "edit" | "delete" | "export" | "execute_approve"

export type PermissionModule = {
  id: string
  key: string
  label: string
}

export type RolePermissionMatrix = {
  role_id: string
  module_key: string
  permissions: Record<PermissionAction, boolean>
}

export type AssignedRoleUser = {
  id: string
  full_name: string
  email: string
  department: string
  location: string
  status: "active" | "suspended" | "invited"
  last_login: string
  otp_enabled: boolean
  allowed_ip_status: "verified" | "unverified" | "any"
}

export type RoleApiScope = {
  id: string
  name: string
  description: string
  access_level: "read" | "write" | "admin"
  risk_level: "low" | "medium" | "high" | "critical"
  approval_required: boolean
}

export type RoleActivityLog = {
  id: string
  actor_name: string
  action: string
  target: string
  timestamp: string
  risk_level: "low" | "medium" | "high"
  metadata?: Record<string, any>
}
