import { createContext, useContext } from 'react';

// Server-provided flags, passed from PHP via the mount node's data-props.
export interface GroupsConfig {
  canCreateShared: boolean;
  canViewData: boolean;
  // Hides the Data tab.
  isSuperHub: boolean;
}

const defaultConfig: GroupsConfig = {
  canCreateShared: false,
  canViewData: false,
  isSuperHub: false
};

export const GroupsConfigContext = createContext<GroupsConfig>(defaultConfig);

export const useGroupsConfig = () => useContext(GroupsConfigContext);
