import 'package:design_system/design_system.dart';
import 'package:flutter/material.dart';

class SignupAddressScreen extends StatelessWidget {
  const SignupAddressScreen({
    super.key,

    required this.bornAtController,

    required this.relationshipSelected,
    required this.onRelationshipChanged,
    required this.relationshipOptions,
    required this.relationshipHint,
    required this.relationshipLabel,

    required this.placeOfBirthController,
    required this.birthCountryController,

    required this.streetController,
    required this.cityController,
    required this.provinceController,
    required this.stateController,

    required this.addressCountrySelected,
    required this.onAddressCountryChanged,
    required this.addressCountryOptions,
    required this.addressCountryHint,
    required this.addressCountryLabel,

    required this.postCodeController,

    required this.birthDateLabel,
    required this.birthDateHint,

    required this.placeOfBirthLabel,
    required this.placeOfBirthHint,

    required this.birthCountryLabel,
    required this.birthCountryHint,

    required this.streetLabel,
    required this.streetHint,

    required this.cityLabel,
    required this.cityHint,

    required this.provinceLabel,
    required this.provinceHint,

    required this.stateLabel,
    required this.stateHint,

    required this.postCodeLabel,
    required this.postCodeHint,
  });

  final TextEditingController bornAtController;

  final String? relationshipSelected;
  final ValueChanged<String?> onRelationshipChanged;
  final List<String> relationshipOptions;
  final String relationshipHint;
  final String relationshipLabel;

  final TextEditingController placeOfBirthController;
  final TextEditingController birthCountryController;

  final TextEditingController streetController;
  final TextEditingController cityController;
  final TextEditingController provinceController;
  final TextEditingController stateController;

  final String? addressCountrySelected;
  final ValueChanged<String?> onAddressCountryChanged;
  final List<String> addressCountryOptions;
  final String addressCountryHint;
  final String addressCountryLabel;

  final TextEditingController postCodeController;

  final String birthDateLabel;
  final String birthDateHint;

  final String placeOfBirthLabel;
  final String placeOfBirthHint;

  final String birthCountryLabel;
  final String birthCountryHint;

  final String streetLabel;
  final String streetHint;

  final String cityLabel;
  final String cityHint;

  final String provinceLabel;
  final String provinceHint;

  final String stateLabel;
  final String stateHint;

  final String postCodeLabel;
  final String postCodeHint;

  @override
  Widget build(BuildContext context) {
    return Column(
      children: [
        CustomTextField(
          label: birthDateLabel,
          hint: birthDateHint,
          keyboardType: TextInputType.number,
          controller: bornAtController,
        ),
        const SizedBox(height: 8),

        Align(
          alignment: Alignment.bottomLeft,
          child: Text(relationshipLabel, style: const TextStyle(fontSize: 14)),
        ),
        CustomDropdown(
          items: relationshipOptions.map(Text.new).toList(growable: false),
          values: relationshipOptions,
          value: relationshipSelected,
          hint: relationshipHint,
          onChanged: (v) => onRelationshipChanged(v as String?),
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: placeOfBirthLabel,
          hint: placeOfBirthHint,
          controller: placeOfBirthController,
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: birthCountryLabel,
          hint: birthCountryHint,
          controller: birthCountryController,
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: streetLabel,
          hint: streetHint,
          controller: streetController,
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: cityLabel,
          hint: cityHint,
          controller: cityController,
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: provinceLabel,
          hint: provinceHint,
          controller: provinceController,
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: stateLabel,
          hint: stateHint,
          controller: stateController,
        ),
        const SizedBox(height: 8),

        Align(
          alignment: Alignment.bottomLeft,
          child: Text(
            addressCountryLabel,
            style: const TextStyle(fontSize: 14, letterSpacing: 0),
          ),
        ),
        CustomDropdown(
          items: addressCountryOptions.map(Text.new).toList(growable: false),
          values: addressCountryOptions,
          value: addressCountrySelected,
          hint: addressCountryHint,
          onChanged: (v) => onAddressCountryChanged(v as String?),
        ),
        const SizedBox(height: 8),

        CustomTextField(
          label: postCodeLabel,
          hint: postCodeHint,
          keyboardType: TextInputType.number,
          controller: postCodeController,
        ),
      ],
    );
  }
}
