import { useFrameModule } from '@/business/frame/hooks';
import { FrameModuleView } from '@/components/frame/FrameModuleView';
import { FrameLoadingPanel } from '@/components/frame/FrameStatusPanel';
import type { UserRole } from '@/shared/types/app';

interface FrameModuleProps {
  userRole: UserRole;
  userName: string;
}

const FrameModule = ({ userRole, userName }: FrameModuleProps) => {
  const workflow = useFrameModule(userRole, userName);

  if (workflow.isLoading) {
    return <FrameLoadingPanel />;
  }

  return <FrameModuleView workflow={workflow} />;
};

export default FrameModule;
