export const PERMISSION_BITS = Object.freeze({ menu: 256, view: 1, add: 2, edit: 4, delete: 8 });

export const PERMISSION_LEVELS = Object.freeze([
  { key: "menu", label: "Menu", bit: PERMISSION_BITS.menu, computed: true, computedHint: "Ativado automaticamente por Visualizar." },
  { key: "view", label: "Visualizar", bit: PERMISSION_BITS.view },
  { key: "add", label: "Cadastrar", bit: PERMISSION_BITS.add },
  { key: "edit", label: "Editar", bit: PERMISSION_BITS.edit },
  { key: "delete", label: "Excluir", bit: PERMISSION_BITS.delete },
]);

export const applyComputedLevels = (bits) => bits & PERMISSION_BITS.view
  ? bits | PERMISSION_BITS.menu
  : bits & ~PERMISSION_BITS.menu;

export const FRANCHISEE_PERMISSION_MENUS = Object.freeze([
  { scope: "franchisee_dashboard", label: "Dashboard", icon: "mdi-poll" },
  { scope: "franchisee_students", label: "Alunos", icon: "mdi-account-outline" },
  { scope: "franchisee_contracts", label: "Contratos", icon: "mdi-file-document-outline" },
  { scope: "franchisee_classes", label: "Agenda / Aulas", icon: "mdi-calendar" },
  { scope: "franchisee_financial", label: "Financeiro", icon: "mdi-finance" },
  { scope: "franchisee_packages", label: "Pacotes", icon: "mdi-package-variant-closed" },
  { scope: "franchisee_users", label: "Usuários", icon: "mdi-account-multiple-outline" },
  { scope: "franchisee_permissions", label: "Permissões", icon: "mdi-shield-account-outline" },
  { scope: "franchisee_unit", label: "Unidade", icon: "mdi-cog-outline" },
  { scope: "franchisee_support", label: "Suporte", icon: "mdi-lifebuoy" },
  { scope: "franchisee_activities", label: "Atividades", icon: "mdi-clipboard-list-outline" },
  { scope: "franchisee_orders", label: "Pedidos", icon: "mdi-cart-outline" },
]);
