import 'package:json_annotation/json_annotation.dart';

import '../../../api_response.dart';

part 'get_reactions_response.g.dart';

@JsonSerializable(explicitToJson: true)
class GetReactionsResponse extends ApiResponse {
  Map<String, List<GetReactionsResponseObject>> data;

  GetReactionsResponse(this.data);

  factory GetReactionsResponse.fromJson(Map<String, dynamic> json) =>
      _$GetReactionsResponseFromJson(json);
  Map<String, dynamic> toJson() => _$GetReactionsResponseToJson(this);
}

@JsonSerializable()
class GetReactionsResponseObject {
  GetReactionsResponseObjectActorType actorType;
  String actorId;
  String actorDisplayName;
  int timestamp;

  GetReactionsResponseObject(
    this.actorType,
    this.actorId,
    this.actorDisplayName,
    this.timestamp,
  );

  factory GetReactionsResponseObject.fromJson(Map<String, dynamic> json) =>
      _$GetReactionsResponseObjectFromJson(json);
  Map<String, dynamic> toJson() => _$GetReactionsResponseObjectToJson(this);
}

enum GetReactionsResponseObjectActorType {
  @JsonValue('guests')
  guests,
  @JsonValue('users')
  users,
}
