import type { CustomWorldGenerationProgress } from '../../../packages/shared/src/contracts/runtime';
import type { CustomWorldStructuredAnchorEntry } from '../../services/customWorldAgentGenerationProgress';
import { CustomWorldGenerationView } from '../CustomWorldGenerationView';
import type { UnifiedGenerationPlayId } from './unifiedGenerationCopy';
import { getUnifiedGenerationCopy } from './unifiedGenerationCopy';

type UnifiedGenerationPageProps = {
  playId: UnifiedGenerationPlayId;
  settingText: string;
  anchorEntries?: CustomWorldStructuredAnchorEntry[];
  progress: CustomWorldGenerationProgress | null;
  isGenerating: boolean;
  error?: string | null;
  onBack: () => void;
  onEditSetting: () => void;
  onRetry: () => void;
  hideBatchModule?: boolean;
};

export function UnifiedGenerationPage({
  playId,
  settingText,
  anchorEntries = [],
  progress,
  isGenerating,
  error = null,
  onBack,
  onEditSetting,
  onRetry,
  hideBatchModule = false,
}: UnifiedGenerationPageProps) {
  const copy = getUnifiedGenerationCopy(playId);

  return (
    <CustomWorldGenerationView
      settingText={settingText}
      anchorEntries={anchorEntries}
      progress={progress}
      isGenerating={isGenerating}
      error={error}
      onBack={onBack}
      onEditSetting={onEditSetting}
      onRetry={onRetry}
      onInterrupt={undefined}
      backLabel="返回创作中心"
      settingActionLabel={null}
      retryLabel={copy.retryLabel}
      settingDescription={null}
      progressTitle={copy.progressTitle}
      activeBadgeLabel={copy.activeBadgeLabel}
      pausedBadgeLabel="素材生成已暂停"
      idleBadgeLabel="等待返回工作区"
      hideBatchModule={hideBatchModule}
    />
  );
}

export default UnifiedGenerationPage;
