import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_svg/svg.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/onetime_password_page.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/timelimited_password_page.dart';
import 'package:syncrow_app/features/devices/view/widgets/smart_door/view_temporary_password.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/default_scaffold.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_medium.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';

class TemporaryPasswordPage extends StatelessWidget {
  final String? deviceId;
  const TemporaryPasswordPage({super.key,this.deviceId});

  @override
  Widget build(BuildContext context) {
    return DefaultScaffold(
      title: 'Temporary Password',
      child: Column(
        children: [
          const SizedBox(height: 10),
          Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const BodyLarge(
                text: 'Online Password',
                fontWeight: FontWeight.normal,
                fontColor: Color(0xfff999999),
              ),
              const BodyMedium(
                text: 'We recommend that you use the online password when the Wi-Fi network is stable.',
                fontWeight: FontWeight.normal,
                fontColor: ColorsManager.grayColor,
              ),
              const SizedBox(height: 10),
              DefaultContainer(
                padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 10),
                child:ListTile(
                  contentPadding: EdgeInsets.zero,
                  leading: SvgPicture.asset(
                      Assets.timeLimitedPasswordIcon),
                  title: const BodyMedium(
                    text: 'Time-Limited Password',
                    fontWeight: FontWeight.normal,
                  ),
                  onTap: () {
                    Navigator.of(context).push(MaterialPageRoute(builder: (context) =>
                        ViewTemporaryPassword(
                            deviceId:deviceId,
                            type:'Online Password'),
                    ));
                  },
                  trailing: const Icon(
                    Icons.arrow_forward_ios,
                    color: ColorsManager.greyColor,
                    size: 15,
                  ),
                ),
              ),
            ],
          ),
          const SizedBox(height: 10),
          Column(
            mainAxisAlignment: MainAxisAlignment.start,
            crossAxisAlignment: CrossAxisAlignment.start,
            children: [
              const BodyLarge(
                text: 'Offline Password',
                fontWeight: FontWeight.normal,
                fontColor: Color(0xfff999999),
              ),
              const BodyMedium(
                text: 'WWe recommend that you use the offline password when the Wi-Fi is disconnected or in an unstable Wi-Fi environment.',
                fontWeight: FontWeight.normal,
                fontColor: ColorsManager.grayColor,
              ),
              const SizedBox(height: 10),
              DefaultContainer(
                  padding: const EdgeInsets.symmetric(horizontal: 15, vertical: 20),
                  child: Column(
                    children: [
                      ListTile(
                        contentPadding: EdgeInsets.zero,
                        leading: SvgPicture.asset(Assets.oneTimePassword),
                        title:
                        const BodyMedium(
                          text: 'One-Time Password',
                          fontWeight: FontWeight.normal,
                        ),
                        onTap: () {
                          Navigator.of(context).push(MaterialPageRoute(builder: (context) =>  OnetimePasswordPage(deviceId:deviceId,),));
                        },
                        trailing: const Icon(
                          Icons.arrow_forward_ios,
                          color: ColorsManager.greyColor,
                          size: 15,
                        ),
                      ),
                      const  Divider(color:ColorsManager.graysColor,),
                      ListTile(
                        contentPadding: EdgeInsets.zero,
                        leading: SvgPicture.asset(
                            Assets.timeLimitedPassword),
                        title: const BodyMedium(
                          text: 'Time-Limited Password',
                          fontWeight: FontWeight.normal,
                        ),
                        onTap: () {
                          Navigator.of(context).push(MaterialPageRoute(builder: (context) =>  TimeLimitedPasswordPage(deviceId:deviceId,),));
                        },
                        trailing: const Icon(
                          Icons.arrow_forward_ios,
                          color: ColorsManager.greyColor,
                          size: 15,
                        ),
                      ),
                    ],)
              ),
            ],
          ),
          const Spacer(),
        ],
      ),
    );
  }
}
