import 'package:flutter/material.dart';

import 'package:provider/provider.dart';

import 'package:pweb/controllers/auth/password_form.dart';
import 'package:pweb/pages/settings/profile/account/password/content.dart';

import 'package:pweb/generated/i18n/app_localizations.dart';


class AccountPassword extends StatelessWidget {
  final String successText;
  final String errorText;
  final String oldPasswordLabel;
  final String newPasswordLabel;
  final String confirmPasswordLabel;
  final String savePassword;

  const AccountPassword({
    super.key,
    required this.successText,
    required this.errorText,
    required this.oldPasswordLabel,
    required this.newPasswordLabel,
    required this.confirmPasswordLabel,
    required this.savePassword,
  });

  @override
  Widget build(BuildContext context) {
    final loc = AppLocalizations.of(context)!;

    return ChangeNotifierProvider(
      create: (_) => PasswordFormController(),
      child: AccountPasswordContent(
        successText: successText,
        errorText: errorText,
        oldPasswordLabel: oldPasswordLabel,
        newPasswordLabel: newPasswordLabel,
        confirmPasswordLabel: confirmPasswordLabel,
        savePassword: savePassword,
        loc: loc,
      ),
    );
  }
}
