import 'package:flutter/material.dart';
import 'package:syncfusion_flutter_calendar/calendar.dart';

import '../../../../state/app/modules/timetable/bloc/timetable_state.dart';
import '../data/arbitrary_appointment.dart';
import 'custom_event_sheet.dart';
import 'lesson_sheet.dart';

class AppointmentDetailsDispatcher {
  static void show(
    BuildContext context,
    TimetableState? state,
    Appointment appointment, {
    bool canEditSubjectColor = false,
  }) {
    final id = appointment.id;
    if (id is! ArbitraryAppointment) return;

    id.when(
      lesson: (entry) => LessonSheet.show(
        context,
        state,
        appointment,
        entry,
        canEditSubjectColor: canEditSubjectColor,
      ),
      custom: (event) => CustomEventSheet.show(context, event),
    );
  }
}
