import 'package:flutter/material.dart';
import 'package:flutter_gen/gen_l10n/app_localizations.dart';

// Bundeswehr
// Gastreitkraefte
// NNE Bund
// Geschaeftsliegenschaft/AGV
// kein

class BimaNutzer extends StatefulWidget {
  final Function(String) onBimaNutzerChanged;
  final String initialStatus;

  const BimaNutzer(
      {super.key, required this.onBimaNutzerChanged, this.initialStatus = 'Bundeswehr'});

  @override
  State<BimaNutzer> createState() => _StatusState();
}

class _StatusState extends State<BimaNutzer> {
  String? _selectedStatus;

  @override
  void initState() {
    super.initState();
    _selectedStatus = widget.initialStatus;
  }

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.bundeswehr),
          leading: Radio<String>(
            value: 'Bundeswehr',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onBimaNutzerChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.gaststreitkraefte),
          leading: Radio<String>(
            value: 'Gaststreitkraefte',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onBimaNutzerChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.nneBund),
          leading: Radio<String>(
            value: 'NNE-Bund',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onBimaNutzerChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.geschaeftsliegenschaftAGV),
          leading: Radio<String>(
            value: 'Geschaeftsliegenschaft/AGV',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onBimaNutzerChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.kein),
          leading: Radio<String>(
            value: 'kein',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onBimaNutzerChanged(value!);
              });
            },
          ),
        ),
      ],
    );
  }
}
