import React from 'react';

import { Button } from '@/components/ui/button';
import { SystemWindowDialog } from '@/components/ui/system-window-dialog';
import { Lang } from '@/lang/Lang';

type Props = {
    open: boolean;
    onOpenChange: (open: boolean) => void;
    text: string;
    onCopy: () => void;
    stackIndex?: number;
};

export default function HallSummaryDialog({
    open,
    onOpenChange,
    text,
    onCopy,
    stackIndex = 1,
}: Props) {
    return (
        <SystemWindowDialog
            open={open}
            onOpenChange={onOpenChange}
            title={Lang.key('hall_summary')}
            width={560}
            stackIndex={stackIndex}
            footer={
                <>
                    <Button
                        onClick={() => onOpenChange(false)}
                        type="button"
                        variant="outline"
                    >
                        {Lang.key('cancel')}
                    </Button>
                    <Button onClick={onCopy} type="button">
                        {Lang.key('hall_summary_copy')}
                    </Button>
                </>
            }
        >
            <pre className="max-h-[60vh] overflow-auto whitespace-pre-wrap break-words rounded-md border bg-slate-50 p-3 text-sm text-slate-800">
                {text || '—'}
            </pre>
        </SystemWindowDialog>
    );
}
