import { PATHS } from '@/shared/constants/paths';
import { useNavigate } from '@/shared/lib/hooks/use-navigate';
import { UserAccountAuthPermItemProps } from '../model/types';

export const UserAccountAuthPermItem = ({
  mid,
  usrid,
  idCL,
  status,
  menuId,
  menuName,
  subMenu,
  menuGrants,
}: UserAccountAuthPermItemProps) => {
  const { navigate } = useNavigate();

  const onClickToNavigation = () => {
    navigate(PATHS.account.user.menuAuth, {
      state: {
        mid: mid,
        usrid: usrid,
        idCl: idCL,
        status: status,
        menuId: menuId,
        menuName: menuName,
        subMenu: subMenu,
        menuGrants: menuGrants,
      }
    })
  };
  return (
    <>
      <div 
        className="perm-item"
        onClick={ () => onClickToNavigation() }
      >
        <span className="perm-name">{ menuName }</span>
        <span className="ic20 arrow-right"></span>
      </div>
    </>
  );
};