export default (initialState: any) => {
  const currentUser = initialState?.user;
  console.log(currentUser);
  const checkReport = (state: number) => {
    if (currentUser?.IsSuper) return true;
    const manager =
      currentUser.is_leader || currentUser.is_opt_mgr || currentUser.is_wty_mgr;
    switch (state) {
      case 0:
        return (
          currentUser.is_accountant ||
          manager ||
          currentUser.Permission['func-01-point-works-report']
        );
      case 1:
        return (
          manager || currentUser.Permission['func-01-point-works-report-p']
        );
      case 2:
        return currentUser.Permission['func-01-point-works-report-d'];
      case 3:
        return (
          currentUser.is_accountant ||
          currentUser.Permission['func-01-point-works-report-p-s']
        );
    }
  };

  return {
    isAdmin: currentUser?.IsSuper,
    appMenu: true,
    adminMenu: false,
  };
};
