/*
 *   Famedly Matrix SDK
 *   Copyright (C) 2020 Famedly GmbH
 *
 *   This program is free software: you can redistribute it and/or modify
 *   it under the terms of the GNU Affero General Public License as
 *   published by the Free Software Foundation, either version 3 of the
 *   License, or (at your option) any later version.
 *
 *   This program is distributed in the hope that it will be useful,
 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 *   GNU Affero General Public License for more details.
 *
 *   You should have received a copy of the GNU Affero General Public License
 *   along with this program.  If not, see .
 */
class RoomKeysSingleKey {
  int firstMessageIndex;
  int forwardedCount;
  bool isVerified;
  Map sessionData;
  RoomKeysSingleKey(
      {this.firstMessageIndex,
      this.forwardedCount,
      this.isVerified,
      this.sessionData});
  RoomKeysSingleKey.fromJson(Map json) {
    firstMessageIndex = json['first_message_index'];
    forwardedCount = json['forwarded_count'];
    isVerified = json['is_verified'];
    sessionData = json['session_data'];
  }
  Map toJson() {
    final data = {};
    data['first_message_index'] = firstMessageIndex;
    data['forwarded_count'] = forwardedCount;
    data['is_verified'] = isVerified;
    data['session_data'] = sessionData;
    return data;
  }
}
class RoomKeysRoom {
  Map sessions;
  RoomKeysRoom({this.sessions}) {
    sessions ??= {};
  }
  RoomKeysRoom.fromJson(Map json) {
    sessions = (json['sessions'] as Map)
        .map((k, v) => MapEntry(k, RoomKeysSingleKey.fromJson(v)));
  }
  Map toJson() {
    final data = {};
    data['sessions'] = sessions.map((k, v) => MapEntry(k, v.toJson()));
    return data;
  }
}
class RoomKeys {
  Map rooms;
  RoomKeys({this.rooms}) {
    rooms ??= {};
  }
  RoomKeys.fromJson(Map json) {
    rooms = (json['rooms'] as Map)
        .map((k, v) => MapEntry(k, RoomKeysRoom.fromJson(v)));
  }
  Map toJson() {
    final data = {};
    data['rooms'] = rooms.map((k, v) => MapEntry(k, v.toJson()));
    return data;
  }
}
class RoomKeysUpdateResponse {
  String etag;
  int count;
  RoomKeysUpdateResponse.fromJson(Map json) {
    etag = json['etag']; // synapse replies an int but docs say string?
    count = json['count'];
  }
  Map toJson() {
    final data = {};
    data['etag'] = etag;
    data['count'] = count;
    return data;
  }
}