import 'package:cims_apps/application/component/custom_app_bar/custom_app_bar.dart';
import 'package:cims_apps/application/component/button/button_view.dart';
import 'package:cims_apps/application/component/set_pin_view/set_pin_view.dart';
import 'package:cims_apps/application/theme/color_palette.dart';
import 'package:cims_apps/core/route/route.dart';
import 'package:cims_apps/core/utils/size_config.dart';
import 'package:cims_apps/features/auth/registration/viewmodel/submission_data_viewmodel.dart';
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';

class TermsAndConditionView extends StatelessWidget {
  const TermsAndConditionView({super.key});

  @override
  Widget build(BuildContext context) {
    List<String> listRules = [
      'I have never committed nor been involved in any breach or violations of laws, especially that in financial terms such as corruption, manipulation, money laundering or terrorism',
      'I have received comprehensive description from mutual marketing officers and fully understood Mutual Fund’s characteristics and therefore is ready for any risks occurring from investing in mutual fund',
      'I have read and understood the content of prospectus, monthly report of mutual fun performance, products and other information related to the Mutual Fund that I am about to purchase',
      'I fully understand that the Mutual Fund is the investment product of PT Gemilang Indonesia Manajemen Investasi and not the product of any selling agent',
      'I fully understand that Investment Product is not included in Government Warranty or Deposit Warranty Institution and therefore such product is not guaranteed by government',
      'I agree to relieve PT Gemilang Indonesia Manajemen Investasi any claims, cost and expenses related to or occurred due to PT Gemilang Indonesia Manajemen Investasi’s actions with regards to its instructions of my mutual fun unit transactions',
      'I fully understand, consider and I am fully responsible for all the investment decision I have made without any influence of PT Gemilang Indonesia Manajemen Investasi or its employees, and;',
      'I declare that all data I have presented are true',
      'I am willing to comply with the provisions set forth in laws in the financial services sectors',
      'PT Gemilang Indonesia Manajemen Investasi may refuse and close business relationship, refuse to transac with prospective customers and/or customers under UJK regulation No. 12/POJK. 01/2017 on the Implementation of Anti Money Laundering and Terrorism Funding Prevention Program in Financial Service Sector',
      'I am willing to provide my data and information from PT Gemilang  Indonesia Manajemen Investasi to groups'
    ];

    return ChangeNotifierProvider(
        create: (context) => SubmissionDataViewModel(),
        builder: (context, child) {
          return Scaffold(
            appBar:
                const CustomAppBar(height: 70, title: 'Terms And Condition'),
            body: SingleChildScrollView(
              padding: const EdgeInsets.all(24),
              child: Column(
                children: [
                  const Text(
                    'In relevance with the data that i have submitted and in relation to the purchase of Mutual Fund Products, I hereby declare that:',
                    style: TextStyle(
                        fontWeight: FontWeight.w600,
                        color: ColorPalette.slate800),
                  ),
                  const SizedBox(height: 12),
                  ...listRules.asMap().entries.map((e) {
                    return Padding(
                      padding: EdgeInsets.only(top: e.key != 0 ? 12 : 0),
                      child: Row(
                        crossAxisAlignment: CrossAxisAlignment.start,
                        children: [
                          Text('${e.key + 1}',
                              style: const TextStyle(
                                  color: ColorPalette.slate500)),
                          const SizedBox(width: 12),
                          Expanded(
                              child: Text(e.value,
                                  style: const TextStyle(
                                      color: ColorPalette.slate500)))
                        ],
                      ),
                    );
                  }),
                  Consumer<SubmissionDataViewModel>(
                      builder: (context, provider, child) {
                    return Padding(
                      padding: const EdgeInsets.only(top: 24.0),
                      child: Row(
                        children: [
                          Expanded(
                              child: ButtonView(
                            name: 'Decline',
                            onPressed: () {
                              Navigator.pop(context);
                            },
                            height: SizeConfig.height * .06,
                            marginVertical: 0,
                            backgroundColor: ColorPalette.white,
                            textColor: ColorPalette.primary,
                            isOutlined: true,
                            borderColor: ColorPalette.primary,
                          )),
                          const SizedBox(width: 16),
                          Expanded(
                              child: ButtonView(
                                  name: 'Accept',
                                  onPressed: () {
                                    provider.nextSubmission(context);
                                    routePush(context,
                                        routeType: RouteType.pushReplace,
                                        page: SetPinView(
                                          currentPin: '',
                                          submitPin: (context, pin) {},
                                        ));
                                  },
                                  height: SizeConfig.height * .06,
                                  marginVertical: 0))
                        ],
                      ),
                    );
                  }),
                ],
              ),
            ),
          );
        });
  }
}
