import 'dart:convert';

import '../../../requestCache.dart';
import 'getCustomTimetableEvent.dart';
import 'getCustomTimetableEventParams.dart';
import 'getCustomTimetableEventResponse.dart';

class GetCustomTimetableEventCache extends RequestCache<GetCustomTimetableEventResponse> {
  GetCustomTimetableEventParams params;

  GetCustomTimetableEventCache(this.params, {onUpdate, renew}) : super(RequestCache.cacheMinute, onUpdate, renew: renew) {
    start('MarianumMobile', 'customTimetableEvents');
  }

  @override
  Future<GetCustomTimetableEventResponse> onLoad() => GetCustomTimetableEvent(params).run();

  @override
  GetCustomTimetableEventResponse onLocalData(String json) => GetCustomTimetableEventResponse.fromJson(jsonDecode(json));
}
