"use client"

/**
 * P2-13: 客户端 Hook，封装 ExamHomeworkRoleConfig 与 usePermission。
 *
 * 使用方式：
 *   const features = useExamHomeworkFeatures()
 *   if (features.canCreate) { render <CreateButton /> }
 */

import { useMemo } from "react"
import { usePermission } from "@/shared/hooks/use-permission"
import { getExamHomeworkFeatures } from "@/shared/config/exam-homework-role-config"

export function useExamHomeworkFeatures() {
  const { roles } = usePermission()
  return useMemo(() => getExamHomeworkFeatures(roles), [roles])
}
