using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Crestron.SimplSharp;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace PepperDash.Essentials.Devices.Common.Codec
{
///
/// Represents a CodecActiveCallItem
///
public class CodecActiveCallItem
{
[JsonProperty("name", NullValueHandling = NullValueHandling.Ignore)]
///
/// Gets or sets the Name
///
public string Name { get; set; }
[JsonProperty("number", NullValueHandling = NullValueHandling.Ignore)]
///
/// Gets or sets the Number
///
public string Number { get; set; }
[JsonProperty("type", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
///
/// Gets or sets the Type
///
public eCodecCallType Type { get; set; }
[JsonProperty("status", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
///
/// Gets or sets the Status
///
public eCodecCallStatus Status { get; set; }
[JsonProperty("direction", NullValueHandling = NullValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
///
/// Gets or sets the Direction
///
public eCodecCallDirection Direction { get; set; }
[JsonProperty("id", NullValueHandling = NullValueHandling.Ignore)]
///
/// Gets or sets the Id
///
public string Id { get; set; }
[JsonProperty("isOnHold", NullValueHandling = NullValueHandling.Ignore)]
///
/// Gets or sets the IsOnHold
///
public bool IsOnHold { get; set; }
[JsonProperty("duration", NullValueHandling = NullValueHandling.Ignore)]
///
/// Gets or sets the Duration
///
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; }
public CodecCallStatusItemChangeEventArgs(CodecActiveCallItem item)
{
CallItem = item;
}
}
}