import 'dart:convert';
import 'dart:typed_data';
import 'package:IQ/app/modules/home/models/languages_currency_model.dart';
import 'package:IQ/app/modules/service/api_service.dart';

LanguagesCurrencyModel? languagesCurrencyModel;
Uint8List? captcha;
int? isCaptcha;
getLanguageCurrencyInforms() async {
  var value = await APIService.get('resources/config', false);
  languagesCurrencyModel = LanguagesCurrencyModel.fromJson(jsonDecode(value));
  isCaptcha = languagesCurrencyModel?.data?.requiresCaptcha;
  return languagesCurrencyModel;
}

getcaptcha(String uuid) async {
  var value = await APIService.get('login/captcha/$uuid', false);
  captcha = dataFromBase64String(jsonDecode(value)["data"]);
  return captcha;
}

Uint8List dataFromBase64String(String base64String) {
  return base64Decode(base64String);
}

String base64String(Uint8List data) {
  return base64Encode(data);
}
