import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/routines/widgets/conditions_routines_devices_view.dart';
import 'package:syncrow_web/pages/routines/widgets/if_container.dart';
import 'package:syncrow_web/pages/routines/widgets/routine_search_and_buttons.dart';
import 'package:syncrow_web/pages/routines/widgets/then_container.dart';
import 'package:syncrow_web/utils/color_manager.dart';

class CreateNewRoutineView extends StatelessWidget {
  final bool isUpdate;
  final String? routineId;
  final bool isScene;

  const CreateNewRoutineView({
    super.key,
    this.isUpdate = false,
    this.routineId,
    this.isScene = true,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      alignment: Alignment.topLeft,
      padding: const EdgeInsets.all(16),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: [
          const RoutineSearchAndButtons(),
          const SizedBox(height: 20),
          Flexible(
            child: Row(
              crossAxisAlignment: CrossAxisAlignment.stretch,
              children: [
                Expanded(
                  child: Card(
                    child: Container(
                        decoration: BoxDecoration(
                          color: ColorsManager.whiteColors,
                          borderRadius: BorderRadius.circular(15),
                        ),
                        child: const ConditionsRoutinesDevicesView()),
                  ),
                ),
                const SizedBox(
                  width: 10,
                ),
                Expanded(
                  child: Column(
                    children: [
                      /// IF Container
                      Expanded(
                        child: Card(
                          margin: EdgeInsets.zero,
                          child: Container(
                            decoration: const BoxDecoration(
                              color: ColorsManager.whiteColors,
                              borderRadius: BorderRadius.only(
                                topLeft: Radius.circular(15),
                                topRight: Radius.circular(15),
                              ),
                            ),
                            child: const IfContainer(),
                          ),
                        ),
                      ),
                      Container(
                        height: 2,
                        width: double.infinity,
                        color: ColorsManager.dialogBlueTitle,
                      ),

                      /// THEN Container
                      Expanded(
                        child: Card(
                          margin: EdgeInsets.zero,
                          child: Container(
                            decoration: const BoxDecoration(
                              color: ColorsManager.boxColor,
                              borderRadius: BorderRadius.only(
                                bottomLeft: Radius.circular(15),
                                bottomRight: Radius.circular(15),
                              ),
                            ),
                            child: const ThenContainer(),
                          ),
                        ),
                      ),
                    ],
                  ),
                ),
              ],
            ),
          ),
        ],
      ),
    );
  }
}
