import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pweb/controllers/settings/profile_actions.dart';
import 'package:pweb/pages/settings/profile/actions/buttons.dart';
import 'package:pweb/pages/settings/profile/actions/constants.dart';
import 'package:pweb/pages/settings/profile/actions/content.dart';


class ProfileActionsSectionBody extends StatelessWidget {
  const ProfileActionsSectionBody({
    super.key,
    required this.nameLabel,
    required this.languageLabel,
    required this.passwordLabel,
    required this.passwordSuccessText,
    required this.passwordErrorText,
    required this.oldPasswordLabel,
    required this.newPasswordLabel,
    required this.confirmPasswordLabel,
    required this.savePasswordLabel,
  });

  final String nameLabel;
  final String languageLabel;
  final String passwordLabel;
  final String passwordSuccessText;
  final String passwordErrorText;
  final String oldPasswordLabel;
  final String newPasswordLabel;
  final String confirmPasswordLabel;
  final String savePasswordLabel;

  @override
  Widget build(BuildContext context) {
    final controller = context.watch<ProfileActionsController>();
    final expandedSection = controller.expandedSection;

    return Column(
      mainAxisSize: MainAxisSize.min,
      crossAxisAlignment: CrossAxisAlignment.center,
      children: [
        ProfileActionButtons(
          nameLabel: nameLabel,
          languageLabel: languageLabel,
          passwordLabel: passwordLabel,
        ),
        if (expandedSection != null) ...[
          const SizedBox(height: ProfileActionsLayoutConstants.contentGap),
          ProfileActionsContent(
            section: expandedSection,
            passwordSuccessText: passwordSuccessText,
            passwordErrorText: passwordErrorText,
            oldPasswordLabel: oldPasswordLabel,
            newPasswordLabel: newPasswordLabel,
            confirmPasswordLabel: confirmPasswordLabel,
            savePasswordLabel: savePasswordLabel,
          ),
        ],
      ],
    );
  }
}
