using System;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace PepperDash.Essentials.Devices.Common.Codec
{
///
/// Represents a CodecActiveCallItem
///
public class CodecActiveCallItem
{
///
/// Gets or sets the Name
///
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
public string Name { get; set; }
///
/// Gets or sets the Number
///
[JsonProperty("number", NullValueHandling = NullValueHandling.Ignore)]
public string Number { get; set; }
///
/// Gets or sets the Type
///
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
public eCodecCallType Type { get; set; }
///
/// Gets or sets the Status
///
[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
public eCodecCallStatus Status { get; set; }
///
/// Gets or sets the Direction
///
[JsonProperty("direction", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
public eCodecCallDirection Direction { get; set; }
///
/// Gets or sets the Id
///
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
public string Id { get; set; }
///
/// Gets or sets the IsOnHold
///
[JsonProperty("isOnHold", NullValueHandling = NullValueHandling.Ignore)]
public bool IsOnHold { get; set; }
///
/// Gets or sets the Duration
///
[JsonProperty("duration", NullValueHandling = NullValueHandling.Ignore)]
public TimeSpan Duration { get; set; }
//public object CallMetaData { get; set; }
///
/// Returns true when this call is any status other than
/// Unknown, Disconnected, Disconnecting
///
[JsonProperty("isActiveCall", NullValueHandling = NullValueHandling.Ignore)]
public bool IsActiveCall
{
get
{
return !(Status == eCodecCallStatus.Disconnected
|| Status == eCodecCallStatus.Disconnecting
|| Status == eCodecCallStatus.Idle
|| Status == eCodecCallStatus.Unknown);
}
}
}
///
/// Represents a CodecCallStatusItemChangeEventArgs
///
public class CodecCallStatusItemChangeEventArgs : EventArgs
{
///
/// Gets or sets the CallItem
///
public CodecActiveCallItem CallItem { get; private set; }
///
/// Initializes a new instance of the CodecCallStatusItemChangeEventArgs class
///
/// The call item that changed
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
{
CallItem = item;
}
}
}