import 'package:hub/shared/helpers/base_storage.dart';
import 'package:hub/shared/helpers/storage_helper.dart';
import 'package:share_plus/share_plus.dart';

class ShareUtil {
  static Future<void> showShare(payload) async {
    final cliName = await StorageHelper().get(SQLiteStorageKey.clientName.value, Storage.SQLiteStorage);
    final cliUUID = await StorageHelper().get(SQLiteStorageKey.clientUUID.value, Storage.SQLiteStorage);

    for (var i = 0; i < payload['convites'].length; i++) {
      await Share.share('''
Olá, \*${payload['convites'][i]['VTE_NOME']}\*! Você foi convidado para \*$cliName\*.

\*Validade do Convite\*:
- Início: ${payload['convites'][i]['VAW_DTINICIO']}
- Fim: ${payload['convites'][i]['VAW_DTFIM']}

URL do Convite: https://visita.freaccess.com.br/${payload['convites'][i]['VAW_ID']}/$cliUUID/${payload['convites'][i]['VAW_CHAVE']}
''');
    }
  }
}
