import 'dart:io';

import 'package:yumi/shared/business_logic/models/res/gift_res.dart';
import 'package:yumi/shared/business_logic/repositories/gift_repository.dart';

import 'package:yumi/shared/data_sources/sources/remote/net/network_client.dart';

class SCGiftRepositoryImp implements SocialChatGiftRepository {
  static SCGiftRepositoryImp? _instance;

  SCGiftRepositoryImp._internal();

  factory SCGiftRepositoryImp() {
    return _instance ??= SCGiftRepositoryImp._internal();
  }

  ///gift/wall
  @override
  Future<List<SocialChatGiftRes>> giftWall(String userId) async {
    final result = await http.get<List<SocialChatGiftRes>>(
      "6cda6ef50ed40e4656f0484136188abe",
      queryParams: {"userId": userId},
      fromJson:
          (json) => (json as List).map((e) => SocialChatGiftRes.fromJson(e)).toList(),
    );
    return result;
  }
}
