using System;
using TINK.Repository;
namespace TINK.Model.Connector
{
/// Holds user infromation required for copri related commands/ query operations.
public class BaseLoggedIn : Base
{
/// Session cookie used to sign in to copri.
public string SessionCookie { get; }
/// Mail address of the user.
protected string Mail { get; }
/// Object which provides date time info.
protected readonly Func DateTimeProvider;
/// Constructs a copri query object.
/// Server which implements communication.
public BaseLoggedIn(ICopriServerBase p_oCopriServer,
string p_strSessionCookie,
string p_strMail,
Func p_oDateTimeProvider) : base(p_oCopriServer)
{
if (string.IsNullOrEmpty(p_strSessionCookie))
throw new ArgumentException("Can not instantiate query object- object. Session cookie must never be null or emtpy.");
if (string.IsNullOrEmpty(p_strMail))
throw new ArgumentException("Can not instantiate query object- object. Mail address must never be null or emtpy.");
DateTimeProvider = p_oDateTimeProvider
?? throw new ArgumentException("Can not instantiate connector- object. No date time provider object available.");
SessionCookie = p_strSessionCookie;
Mail = p_strMail;
}
}
}