using System;
using ShareeBike.Repository;
namespace ShareeBike.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 copriServer,
string sessionCookie,
string mail,
Func p_oDateTimeProvider) : base(copriServer)
{
if (string.IsNullOrEmpty(sessionCookie))
throw new ArgumentException("Can not instantiate query object- object. Session cookie must never be null or emtpy.");
if (string.IsNullOrEmpty(mail))
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 = sessionCookie;
Mail = mail;
}
}
}