using System;
using System.Runtime.Serialization;
using Newtonsoft.Json;
namespace TINK.Model.State
{
///
/// Manages state booked.
///
[DataContract]
public sealed class StateOccupiedInfo : BaseState, IBaseState, INotAvailableState
{
///
/// Prevents an invalid instance to be created.
///
private StateOccupiedInfo() : base(InUseStateEnum.Booked)
{
}
///
/// Constructs an object holding booked state info.
///
/// Date time when bike was booked
///
///
public StateOccupiedInfo(
DateTime p_oFrom,
string p_strMailAddress,
string p_strCode) : base(InUseStateEnum.Booked)
{
From = p_oFrom;
MailAddress = p_strMailAddress;
Code = p_strCode;
}
/// Constructor for Json serialization.
/// Unused value.
/// Date time when bike was booked
///
///
[JsonConstructor]
private StateOccupiedInfo(
InUseStateEnum Value,
DateTime From,
string MailAddress,
string Code) : this(From, MailAddress, Code)
{
}
///
/// Gets the info that state is reserved.
/// Setter exists only for serialization purposes.
///
public override InUseStateEnum Value
{
get
{
return InUseStateEnum.Booked;
}
}
///
/// Prevents an invalid instance to be created.
///
[DataMember]
public DateTime From { get; }
///
/// Mail address of user who bookec the bike.
///
[DataMember]
public string MailAddress { get; }
///
/// Booking code.
///
[DataMember]
public string Code { get; }
}
}