import 'package:json_annotation/json_annotation.dart';

import '../../../apiResponse.dart';

part 'getParticipantsResponse.g.dart';

@JsonSerializable(explicitToJson: true)
class GetParticipantsResponse extends ApiResponse {
  Set<GetParticipantsResponseObject> data;

  GetParticipantsResponse(this.data);

  factory GetParticipantsResponse.fromJson(Map<String, dynamic> json) => _$GetParticipantsResponseFromJson(json);
  Map<String, dynamic> toJson() => _$GetParticipantsResponseToJson(this);
}

@JsonSerializable(explicitToJson: true)
class GetParticipantsResponseObject {
  int attendeeId;
  String actorType;
  String actorId;
  String displayName;
  GetParticipantsResponseObjectParticipantType participantType;
  int lastPing;
  GetParticipantsResponseObjectParticipantsInCallFlags inCall;
  int permissions;
  int attendeePermissions;
  String? sessionId;
  List<String> sessionIds;
  String? status;
  String? statusIcon;
  String? statusMessage;
  String? roomToken;

  GetParticipantsResponseObject(
      this.attendeeId,
      this.actorType,
      this.actorId,
      this.displayName,
      this.participantType,
      this.lastPing,
      this.inCall,
      this.permissions,
      this.attendeePermissions,
      this.sessionId,
      this.sessionIds,
      this.status,
      this.statusIcon,
      this.statusMessage,
      this.roomToken);

  factory GetParticipantsResponseObject.fromJson(Map<String, dynamic> json) => _$GetParticipantsResponseObjectFromJson(json);
  Map<String, dynamic> toJson() => _$GetParticipantsResponseObjectToJson(this);
}

enum GetParticipantsResponseObjectParticipantType {
  @JsonValue(1) owner,
  @JsonValue(2) moderator,
  @JsonValue(3) user,
  @JsonValue(4) guest,
  @JsonValue(5) userFollowingPublicLink,
  @JsonValue(6) guestWithModeratorPermissions
}

enum GetParticipantsResponseObjectParticipantsInCallFlags {
  @JsonValue(0) disconnected,
  @JsonValue(1) inCall,
  @JsonValue(2) providesAudio,
  @JsonValue(3) providesVideo,
  @JsonValue(4) usesSipDialIn
}