import 'package:freezed_annotation/freezed_annotation.dart';

part 'capabilities_state.freezed.dart';
part 'capabilities_state.g.dart';

@freezed
abstract class CapabilitiesState with _$CapabilitiesState {
  const factory CapabilitiesState({
    @Default(false) bool viewForeignTimetables,
    @Default(false) bool pushNotifications,
    // Days into the past/future the timetable may be scrolled. Null = no
    // client-side clamp; the (server-narrowed) school year alone governs.
    int? timetablePastDays,
    int? timetableFutureDays,
    // LDAP user type ('TEACHER' | 'STUDENT' | 'STAFF'); null = unknown.
    String? userType,
    // Whether a capability response (or a definitive failure) has been
    // observed at least once this session. Lets the UI distinguish "still
    // unknown" from "confirmed not allowed".
    @Default(false) bool loaded,
  }) = _CapabilitiesState;

  factory CapabilitiesState.fromJson(Map<String, Object?> json) =>
      _$CapabilitiesStateFromJson(json);
}
