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

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

class Status extends StatefulWidget {
  final Function(String) onStatusChanged;
  final String initialStatus;

  const Status(
      {super.key, required this.onStatusChanged, this.initialStatus = 'Aktiv'});

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

class _StatusState extends State<Status> {
  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)!.),
          leading: Radio<String>(
            value: 'Bundeswehr',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onStatusChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.gesamtstreitkraefte),
          leading: Radio<String>(
            value: 'Gaststreitkraefte',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onStatusChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.),
          leading: Radio<String>(
            value: 'NNE-Bund',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onStatusChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.),
          leading: Radio<String>(
            value: 'Geschaeftsliegenschaft/AGV',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onStatusChanged(value!);
              });
            },
          ),
        ),
        ListTile(
          visualDensity: const VisualDensity(vertical: -4),
          title: Text(AppLocalizations.of(context)!.),
          leading: Radio<String>(
            value: 'kein',
            groupValue: _selectedStatus,
            onChanged: (value) {
              setState(() {
                _selectedStatus = value;
                widget.onStatusChanged(value!);
              });
            },
          ),
        ),
      ],
    );
  }
}
