import 'dart:convert';

import 'package:http/http.dart';
import 'package:http/http.dart' as http;

import '../../mhsl_api.dart';
import 'get_custom_timetable_event_params.dart';
import 'get_custom_timetable_event_response.dart';

class GetCustomTimetableEvent extends MhslApi<GetCustomTimetableEventResponse> {
  GetCustomTimetableEventParams params;
  GetCustomTimetableEvent(this.params)
    : super('server/timetable/customEvents?user=${params.user}');

  @override
  GetCustomTimetableEventResponse assemble(String raw) =>
      GetCustomTimetableEventResponse.fromJson({'events': jsonDecode(raw)});

  @override
  Future<Response>? request(Uri uri) => http.get(uri);
}
