import 'package:json_annotation/json_annotation.dart';
part 'model.g.dart';

@JsonSerializable()
class FbProfile {
  final String photo;
  final String name; 
  final String id;
  final String contextType;
  final String? userId;

  const FbProfile({
    required this.photo,
    required this.name,
    required this.id,
    required this.contextType,
    this.userId
  });

  factory FbProfile.fromJson(Map<String, dynamic> json) => _$FbProfileFromJson(json);

  Map<String, dynamic> toJson() => _$FbProfileToJson(this);
}

@JsonSerializable()
class FbShareData {
  final String image;
  final String text;
  final Map<String, String> data;
  final List<String> shareDestination;
  final bool switchContext;

  const FbShareData({
    this.image = 'data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAJAAAACQCAMAAADQmBKKAAAAAXNSR0IArs4c6QAAAkxQTFRFAAAAJCQkGhoaDAwMFxcXFhYWFBQUDAwMDAwMEBAQEBAQDw8PDg4ODg4ODQ0NDQ0NDQ0NDAwMDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDQ0NDAwMDAwMDAwMBwcHCAgICQkJCgoKCwsLDAwMDg4ODw8PEBAQEhISFxcXGhoaGxsbHR0dHh4eHx8fICAgISEhIyMjJCQkJSUlJiYmLCwsLS0tMDAwMjIyMzMzNjY2Nzc3ODg4QEBAQUFBRERERkZGTk5OT09PU1NTV1dXWFhYW1tbXFxcXV1dX19fYGBgYWFhZmZmaGhoaWlpbGxsbm5ucXFxcnJydXV1dnZ2eHh4enp6e3t7fHx8fX19fn5+f39/gICAgoKCg4ODhISEhYWFiYmJi4uLjIyMjY2Njo6Oj4+PkJCQkZGRk5OTlZWVl5eXmZmZmpqam5ubnZ2dnp6eoKCgoaGho6OjpKSkp6enqKioqampqqqqrKysra2trq6ur6+vsLCwsrKys7OztLS0tbW1tra2t7e3uLi4ubm5urq6u7u7vLy8vr6+v7+/wMDAwcHBwsLCxMTExcXFxsbGx8fHyMjIycnJysrKy8vLzc3Nzs7Oz8/P0NDQ0dHR0tLS09PT1NTU1dXV1tbW2NjY2dnZ2tra29vb3t7e39/f4ODg4eHh4uLi4+Pj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K1nQaENcmNs54KTJGl703s/jfgDy2GFEqgIZ8MbkkR5KWM+3pZA2ib4U5+FuWmSLgr+q6XY20opqlA/WGhh420mEtt4i781mX1K4ofF8APKsb69nWnKtANseAHlkR6RwCjFtg6RoB/dIRLEx2zQTE0BzweR8HdUC3+H2XB33A9/ByLxd2QUh4dq8Xfs2NrBNnwdzBY7SiaTR9flYp2mdwNfh/s5fPzh/zcuYJd5bFPWAAAAAElFTkSuQmCC',
    required this.text,
    this.data = const {},
    this.shareDestination = const [
      'NEWSFEED',
      'GROUP',
      'COPY_LINK',
      'MESSENGER'
    ],
    this.switchContext = false,
  });

  factory FbShareData.fromJson(Map<String, dynamic> json) => _$FbShareDataFromJson(json);

  Map<String, dynamic> toJson() => _$FbShareDataToJson(this);
}

@JsonSerializable()
class FbInviteTextData {
  final String text;
  // localizations: {
  //   ar_AR: 'X \u0641\u0642\u0637 \u063A\u0632\u062A ' +
  //     '\u0642\u0631\u064A\u0629 Y!',
  //   en_US: 'X just invaded Y\'s village!',
  //   es_LA: '\u00A1X acaba de invadir el pueblo de Y!'
  // }
  final Map<String, String> localizations;

  const FbInviteTextData({required this.text, required this.localizations});

  Map<String, dynamic> toMap() {
    return {
      'default': text,
      'localizations': localizations,
    };
  }


  factory FbInviteTextData.fromJson(Map<String, dynamic> json) => _$FbInviteTextDataFromJson(json);

  Map<String, dynamic> toJson() => _$FbInviteTextDataToJson(this);
}

@JsonSerializable()
class FbInviteData {
  final String image;
  final FbInviteTextData text;
  final FbInviteTextData? cta;
  final FbInviteTextData? dialogTitle;
  final List<String>? filters;  // ['NEW_CONTEXT_ONLY', 'EXISTING_PLAYERS_ONLY']
  // sections: [
  //   {sectionType: 'GROUPS', maxResults: 2},
  //   {sectionType: 'USERS'}
  // ],
  final List<Map<String, dynamic>>? sections;

  const FbInviteData({
    required this.image,
    required this.text,
    this.cta,
    this.dialogTitle,
    this.filters,
    this.sections,
  });

  factory FbInviteData.fromJson(Map<String, dynamic> json) => _$FbInviteDataFromJson(json);

  Map<String, dynamic> toJson() => _$FbInviteDataToJson(this);
}

@JsonSerializable()
class GuruLogDeviceData{
  final String appId;
  final String version;
  final String fbPlatform;

  GuruLogDeviceData({
    required this.appId,
    this.version = '1.0.0',
    required this.fbPlatform
  });

  factory GuruLogDeviceData.fromJson(Map<String, dynamic> json) => _$GuruLogDeviceDataFromJson(json);

  Map<String, dynamic> toJson() => _$GuruLogDeviceDataToJson(this);
}

@JsonSerializable()
class GuruLogInfoData {
  final String? deveiceId;
  final String? uid;
  final String? adjustId;
  final String? adId;
  final String? firebaseId;

  const GuruLogInfoData({
    this.deveiceId,
    this.uid,
    this.adjustId,
    this.adId,
    this.firebaseId
  });

  factory GuruLogInfoData.fromJson(Map<String, dynamic> json) => _$GuruLogInfoDataFromJson(json);

  Map<String, dynamic> toJson() => _$GuruLogInfoDataToJson(this);
}

@JsonSerializable()
class InitGuruLogEventData {
  final String appId;
  final GuruLogDeviceData deviceInfo;
  final GuruLogInfoData info;

  const InitGuruLogEventData({
    required this.appId,
    required this.deviceInfo,
    required this.info
  });

  factory InitGuruLogEventData.fromJson(Map<String, dynamic> json) => _$InitGuruLogEventDataFromJson(json);

  Map<String, dynamic> toJson() => _$InitGuruLogEventDataToJson(this);
}

enum FBTournamentSortOrder{
  HIGHER_IS_BETTER, LOWER_IS_BETTER;
}

enum FBTournamentSortFormat{
  NUMERIC, TIME;
}

@JsonSerializable()
class FbTournamentConfig{
  final String? title;
  final String? image;
  //  "HIGHER_IS_BETTER"｜ "LOWER_IS_BETTER"
  final FBTournamentSortOrder? sortOrder;
  // "NUMERIC" | "TIME"
  final FBTournamentSortFormat? scoreFormat;
  // timestamp
  final num? endTime;

  const FbTournamentConfig({
    this.title,
    this.image,
    this.sortOrder,
    this.scoreFormat,
    this.endTime
  });

  factory FbTournamentConfig.fromJson(Map<String, dynamic> json) => _$FbTournamentConfigFromJson(json);

  Map<String, dynamic> toJson() => _$FbTournamentConfigToJson(this);
}

@JsonSerializable()
class FbUserInfo {
  @JsonKey(name: 'player_id', defaultValue: "")
  final String id;

  @JsonKey(name: 'user_id', defaultValue: "")
  final String userId;

  @JsonKey(name: 'name', defaultValue: "")
  final String name;

  @JsonKey(name: 'picUrl', defaultValue: "")
  final String picUrl;

  FbUserInfo(this.id, this.userId, this.name, this.picUrl);

  factory FbUserInfo.fromJson(Map<String, dynamic> json) => _$FbUserInfoFromJson(json);

  Map<String, dynamic> toJson() => _$FbUserInfoToJson(this);
}

enum FBContextType {
  @JsonValue("POST") POST,
  @JsonValue("THREAD") THREAD,
  @JsonValue("GROUP") GROUP,
  @JsonValue("SOLO") SOLO
}

@JsonSerializable()
class FBContextInfo {
  final String id;
  final FBContextType type;

  const FBContextInfo({
    required this.id,
    required this.type,
  });

  factory FBContextInfo.fromJson(Map<String, dynamic> json) => _$FBContextInfoFromJson(json);

  Map<String, dynamic> toJson() => _$FBContextInfoToJson(this);
}