import type { TaskArtifact } from '../types';
import { TaskHtmlDoc } from './mode/html-doc';
import { TaskHtmlWeb } from './mode/html-web';
import type { ArtifactEditState } from './types';

export const TaskArtifactHtml: React.FC<{
  taskId: string;
  editable?: boolean;
  taskArtifact: TaskArtifact;
  type: 'document' | 'web';
  onStateChange?: (state: ArtifactEditState) => void;
}> = (props) => {
  const { taskId, editable, taskArtifact, type, onStateChange } = props;
  const Component = type === 'document' ? TaskHtmlDoc : TaskHtmlWeb;
  return (
    <Component
      taskId={taskId}
      taskArtifact={taskArtifact}
      editable={editable}
      onStateChange={onStateChange}
    />
  );
};
