import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
import 'package:syncrow_web/pages/device_managment/garage_door/bloc/garage_door_state.dart';
import 'package:syncrow_web/pages/device_managment/garage_door/schedule_view/schedule__garage_table.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';

class ScheduleGarageManagementUI extends StatelessWidget {
  final GarageDoorLoadedState state;
  final Function onAddSchedule;

  const ScheduleGarageManagementUI({
    super.key,
    required this.state,
    required this.onAddSchedule,
  });

  @override
  Widget build(BuildContext context) {
    return Column(
      crossAxisAlignment: CrossAxisAlignment.start,
      children: [
        SizedBox(
          width: 170,
          height: 40,
          child: DefaultButton(
            borderColor: ColorsManager.boxColor,
            padding: 2,
            backgroundColor: ColorsManager.graysColor,
            borderRadius: 15,
            onPressed: () => onAddSchedule(),
            child: Row(
              children: [
                const Icon(Icons.add, color: ColorsManager.primaryColor),
                Text(
                  ' Add new schedule',
                  style: context.textTheme.bodySmall!.copyWith(
                    color: ColorsManager.blackColor,
                  ),
                ),
              ],
            ),
          ),
        ),
        const SizedBox(height: 20),
        ScheduleGarageTableWidget(state: state),
      ],
    );
  }
}
