Files
eatvio_app/lib/features/video_calls/models/video_call_models.dart

71 lines
2.3 KiB
Dart

import 'package:freezed_annotation/freezed_annotation.dart';
part 'video_call_models.freezed.dart';
part 'video_call_models.g.dart';
@freezed
abstract class VideoCallTokenResponse with _$VideoCallTokenResponse {
const factory VideoCallTokenResponse({
required String token,
required String roomName,
required String wsUrl,
@JsonKey(name: 'call_id') String? callId,
@JsonKey(name: 'call_status') String? callStatus,
@JsonKey(name: 'call_expires_at') String? callExpiresAt,
}) = _VideoCallTokenResponse;
factory VideoCallTokenResponse.fromJson(Map<String, Object?> json) =>
_$VideoCallTokenResponseFromJson(json);
}
@freezed
abstract class VideoCallAdminTokenResponse with _$VideoCallAdminTokenResponse {
const factory VideoCallAdminTokenResponse({
required String adminToken,
required String roomName,
required String apiUrl,
}) = _VideoCallAdminTokenResponse;
factory VideoCallAdminTokenResponse.fromJson(Map<String, Object?> json) =>
_$VideoCallAdminTokenResponseFromJson(json);
}
@freezed
abstract class VideoCallEndedResponse with _$VideoCallEndedResponse {
const factory VideoCallEndedResponse({
required bool sent,
@JsonKey(name: 'call_id') String? callId,
String? status,
}) = _VideoCallEndedResponse;
factory VideoCallEndedResponse.fromJson(Map<String, Object?> json) =>
_$VideoCallEndedResponseFromJson(json);
}
@freezed
abstract class VideoCallAcceptResponse with _$VideoCallAcceptResponse {
const factory VideoCallAcceptResponse({
required bool sent,
@JsonKey(name: 'devices_notified') required int devicesNotified,
@JsonKey(name: 'call_id') String? callId,
String? status,
@JsonKey(name: 'already_accepted') bool? alreadyAccepted,
}) = _VideoCallAcceptResponse;
factory VideoCallAcceptResponse.fromJson(Map<String, Object?> json) =>
_$VideoCallAcceptResponseFromJson(json);
}
@freezed
abstract class VideoCallDeclineResponse with _$VideoCallDeclineResponse {
const factory VideoCallDeclineResponse({
required bool sent,
@JsonKey(name: 'devices_notified') required int devicesNotified,
@JsonKey(name: 'call_id') String? callId,
String? status,
}) = _VideoCallDeclineResponse;
factory VideoCallDeclineResponse.fromJson(Map<String, Object?> json) =>
_$VideoCallDeclineResponseFromJson(json);
}