using Serilog;
using TINK.Repository.Request;
namespace TINK.ViewModel.CopriWebView
{
/// Manages the copri web view for password forgotton use case.
public class PasswordForgottonViewModel
{
/// Holds the merchant id.
private string MerchantId { get; }
/// Holds the name of the host.
private string HostName { get; }
///
/// Holds the current ui two letter ISO language name.
///
private string UiIsoLanguageName { get; }
/// Two letter ISO language name.
public PasswordForgottonViewModel(
string merchantId,
string uiIsoLangugageName,
string hostName)
{
MerchantId = merchantId;
UiIsoLanguageName = uiIsoLangugageName;
HostName = hostName;
}
/// Get Uri of web view providing password forgotton functionality.
public string Uri
{
get
{
var sessionIdQueryElement = QueryBuilderHelper.GetSessionIdQueryElement("?", MerchantId);
string GetUriText()
=> !string.IsNullOrEmpty(sessionIdQueryElement)
? $"https://{HostName}/app/Account{sessionIdQueryElement}{QueryBuilderHelper.GetLanguageQueryElement("&", UiIsoLanguageName)}"
: $"https://{HostName}/app/Account";
Log.ForContext().Debug($"Request to open url {GetUriText()} to get privacy info.");
return GetUriText();
}
}
}
}