import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:syncrow_app/features/devices/model/device_model.dart';
import 'package:syncrow_app/features/devices/view/widgets/three_gang/timer_screen.dart';
import 'package:syncrow_app/features/shared_widgets/default_container.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_large.dart';
import 'package:syncrow_app/features/shared_widgets/text_widgets/body_small.dart';
import 'package:syncrow_app/generated/assets.dart';
import 'package:syncrow_app/utils/context_extension.dart';
import 'package:syncrow_app/utils/resource_manager/color_manager.dart';
import 'package:syncrow_app/utils/resource_manager/font_manager.dart';

class ScheduleScreen extends StatelessWidget {
  final DeviceModel device;
  const ScheduleScreen({required this.device, super.key});

  @override
  Widget build(BuildContext context) {
    return AnnotatedRegion(
        value: SystemUiOverlayStyle(
          statusBarColor: ColorsManager.primaryColor.withOpacity(0.5),
          statusBarIconBrightness: Brightness.light,
        ),
        child: Scaffold(
          backgroundColor: ColorsManager.backgroundColor,
          extendBodyBehindAppBar: true,
          extendBody: true,
          appBar: AppBar(
            backgroundColor: Colors.transparent,
            centerTitle: true,
            title: const BodyLarge(
              text: 'Schedule',
              fontColor: ColorsManager.primaryColor,
              fontWeight: FontsManager.bold,
            ),
          ),
          body: SafeArea(
            child: Container(
              width: MediaQuery.sizeOf(context).width,
              height: MediaQuery.sizeOf(context).height,
              decoration: const BoxDecoration(
                image: DecorationImage(
                  image: AssetImage(
                    Assets.assetsImagesBackground,
                  ),
                  fit: BoxFit.cover,
                  opacity: 0.4,
                ),
              ),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.start,
                crossAxisAlignment: CrossAxisAlignment.start,
                children: [
                  const SizedBox(
                    height: 48,
                  ),
                  DefaultContainer(
                      width: MediaQuery.sizeOf(context).width,
                      child: Column(
                        children: [
                          InkWell(
                            onTap: () {
                              Navigator.push(
                                  context,
                                  PageRouteBuilder(
                                      pageBuilder:
                                          (context, animation1, animation2) =>
                                              TimerScheduleScreen(
                                                switchCode: "switch_1",
                                                device: device,
                                                deviceCode: 'countdown_1',
                                              )));
                            },
                            child: Container(
                              padding: const EdgeInsets.only(
                                  left: 25, right: 15, top: 20, bottom: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  BodySmall(
                                    text: "Bedside Light",
                                    style: context.bodyMedium.copyWith(
                                      color: ColorsManager.textPrimaryColor,
                                      fontSize: 15,
                                      fontWeight: FontWeight.w400,
                                    ),
                                  ),
                                  const Icon(
                                    Icons.arrow_forward_ios,
                                    color: ColorsManager.greyColor,
                                    size: 18,
                                  )
                                ],
                              ),
                            ),
                          ),
                          const Divider(
                            color: ColorsManager.dividerColor,
                          ),
                          InkWell(
                            onTap: () {
                              Navigator.push(
                                  context,
                                  PageRouteBuilder(
                                      pageBuilder:
                                          (context, animation1, animation2) =>
                                              TimerScheduleScreen(
                                                switchCode: "switch_2",
                                                device: device,
                                                deviceCode: 'countdown_2',
                                              )));
                            },
                            child: Container(
                              padding: const EdgeInsets.only(
                                  left: 25, right: 15, top: 20, bottom: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  BodySmall(
                                    text: "Ceiling Light",
                                    style: context.bodyMedium.copyWith(
                                      color: ColorsManager.textPrimaryColor,
                                      fontSize: 15,
                                      fontWeight: FontWeight.w400,
                                    ),
                                  ),
                                  const Icon(
                                    Icons.arrow_forward_ios,
                                    color: ColorsManager.greyColor,
                                    size: 18,
                                  )
                                ],
                              ),
                            ),
                          ),
                          const Divider(
                            color: ColorsManager.dividerColor,
                          ),
                          InkWell(
                            onTap: () {
                              Navigator.push(
                                  context,
                                  PageRouteBuilder(
                                      pageBuilder:
                                          (context, animation1, animation2) =>
                                              TimerScheduleScreen(
                                                switchCode: "switch_3",
                                                device: device,
                                                deviceCode: 'countdown_3',
                                              )));
                            },
                            child: Container(
                              padding: const EdgeInsets.only(
                                  left: 25, right: 15, top: 20, bottom: 20),
                              child: Row(
                                mainAxisAlignment:
                                    MainAxisAlignment.spaceBetween,
                                children: [
                                  BodySmall(
                                    text: "Spotlight",
                                    style: context.bodyMedium.copyWith(
                                      color: ColorsManager.textPrimaryColor,
                                      fontSize: 15,
                                      fontWeight: FontWeight.w400,
                                    ),
                                  ),
                                  const Icon(
                                    Icons.arrow_forward_ios,
                                    color: ColorsManager.greyColor,
                                    size: 18,
                                  )
                                ],
                              ),
                            ),
                          ),
                        ],
                      )),
                ],
              ),
            ),
          ),
        ));
  }
}
