using Serilog;
using ShareeBike.Repository.Request;
namespace ShareeBike.ViewModel.CopriWebView
{
public class RegisterPageViewModel
{
/// 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 RegisterPageViewModel(
string merchantId,
string uiIsoLangugageName,
string hostName)
{
HostName = hostName;
UiIsoLanguageName = uiIsoLangugageName;
MerchantId = merchantId;
}
/// Get Uri of web view for creating account.
public string Uri
{
get
{
var sessionIdQueryElement = QueryBuilderHelper.GetSessionIdQueryElement("?", MerchantId);
string GetUriText()
=> !string.IsNullOrEmpty(sessionIdQueryElement)
? $"https://{HostName}/app/Account/1.%20Kundendaten{sessionIdQueryElement}{QueryBuilderHelper.GetLanguageQueryElement("&", UiIsoLanguageName)}"
: $"https://{HostName}/app/Account/1.%20Kundendaten";
Log.ForContext().Debug($"Request to open url {GetUriText()} to get privacy info.");
return GetUriText();
}
}
}
}