import 'package:flutter/material.dart';
import 'package:syncrow_web/pages/common/buttons/default_button.dart';
import 'package:syncrow_web/pages/device_managment/schedule_device/schedule_widgets/schedule_table.dart';
import 'package:syncrow_web/utils/color_manager.dart';
import 'package:syncrow_web/utils/extension/build_context_x.dart';

class ScheduleManagementUI extends StatelessWidget {
  final String deviceUuid;
  final VoidCallback onAddSchedule;
  final String category;
  final String deviceType;

  const ScheduleManagementUI({
    super.key,
    required this.deviceUuid,
    required this.onAddSchedule,
    required this.deviceType,
    this.category = 'switch_1',
  });

  @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),
        ScheduleTableWidget(
          deviceUuid: deviceUuid,
          category: category,
          deviceType: deviceType,
        ),
      ],
    );
  }
}
