import React from 'react';

import { Button } from '@/components/ui/button';
import {
    Dialog,
    DialogContent,
    DialogFooter,
} from '@/components/ui/dialog';
import { Lang } from '@/lang/Lang';

type Props = {
    open: boolean;
    onOpenChange: (open: boolean) => void;
    name: string;
    onNameChange: (value: string) => void;
    onApply: () => void;
};

export default function SectorSettingsDialog({
    open,
    onOpenChange,
    name,
    onNameChange,
    onApply,
}: Props) {
    return (
        <Dialog open={open} onOpenChange={onOpenChange}>
            <DialogContent className="max-w-md">
                <div className="space-y-4">
                    <div className="text-sm font-semibold">Сектор</div>
                    <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>
                </div>
                <DialogFooter>
                    <Button
                        onClick={() => onOpenChange(false)}
                        type="button"
                        variant="outline"
                    >
                        {Lang.key('cancel')}
                    </Button>
                    <Button onClick={onApply} type="button">
                        {Lang.key('save')}
                    </Button>
                </DialogFooter>
            </DialogContent>
        </Dialog>
    );
}
