import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pweb/controllers/auth/account_name.dart';
import 'package:pweb/controllers/settings/profile_actions.dart';
import 'package:pweb/pages/settings/profile/actions/body.dart';


class ProfileActionsSection extends StatelessWidget {
  const ProfileActionsSection({
    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) {
    return ChangeNotifierProxyProvider<
      AccountNameController,
      ProfileActionsController
    >(
      create: (_) => ProfileActionsController(),
      update: (_, accountNameController, controller) =>
          controller!..updateAccountNameController(accountNameController),
      child: ProfileActionsSectionBody(
        nameLabel: nameLabel,
        languageLabel: languageLabel,
        passwordLabel: passwordLabel,
        passwordSuccessText: passwordSuccessText,
        passwordErrorText: passwordErrorText,
        oldPasswordLabel: oldPasswordLabel,
        newPasswordLabel: newPasswordLabel,
        confirmPasswordLabel: confirmPasswordLabel,
        savePasswordLabel: savePasswordLabel,
      ),
    );
  }
}
