import { PlatformReportDialog } from '../common/PlatformReportDialog';

export type PlatformTaskCompletionDialogPayload = {
  source: string;
  message: string;
};

type PlatformTaskCompletionDialogProps = {
  completion: PlatformTaskCompletionDialogPayload | null;
  onClose: () => void;
  overlayClassName?: string;
  panelClassName?: string;
};

export function PlatformTaskCompletionDialog({
  completion,
  onClose,
  overlayClassName = 'platform-theme platform-theme--light !items-center',
  panelClassName = 'platform-remap-surface rounded-[1.5rem]',
}: PlatformTaskCompletionDialogProps) {
  return (
    <PlatformReportDialog
      open={Boolean(completion)}
      title="生成完成"
      onClose={onClose}
      copyIdleLabel="复制内容"
      fields={
        completion
          ? [
              {
                label: '来源',
                value: completion.source,
              },
              {
                label: '状态',
                value: completion.message,
                multiline: true,
              },
            ]
          : []
      }
      overlayClassName={overlayClassName}
      panelClassName={panelClassName}
    />
  );
}
