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;
    name: string;
    onNameChange: (value: string) => void;
    onApply: () => void;
    stackIndex?: number;
};

export default function SectorSettingsDialog({
    open,
    onOpenChange,
    name,
    onNameChange,
    onApply,
    stackIndex = 1,
}: Props) {
    return (
        <SystemWindowDialog
            open={open}
            onOpenChange={onOpenChange}
            title="Сектор"
            width={448}
            stackIndex={stackIndex}
            footer={
                <>
                    <Button
                        onClick={() => onOpenChange(false)}
                        type="button"
                        variant="outline"
                    >
                        {Lang.key('cancel')}
                    </Button>
                    <Button onClick={onApply} type="button">
                        {Lang.key('save')}
                    </Button>
                </>
            }
        >
            <div className="space-y-2">
                <div className="text-xs text-slate-600">Название</div>
                <input
                    className="w-full border rounded-md h-9 px-3 text-sm"
                    type="text"
                    value={name}
                    onChange={(e) => onNameChange(e.target.value)}
                />
            </div>
        </SystemWindowDialog>
    );
}
