namespace axXez.TS3.Protocol
{
/// Represents a TeamSpeak channel returned by channellist or channelinfo.
public class ChannelInfo : TsEntity, INamedEntity
{
/// Channel ID.
[TsField("cid")]
public int ID { get; protected set; }
/// Unique identifier of the channel.
[TsField("channel_unique_identifier")]
public string UID { get; protected set; }
/// ID of the parent channel; 0 if this is a top-level channel.
[TsField("pid", "cpid")]
public int ParentID { get; protected set; }
/// Phonetic pronunciation of the channel name, used by text-to-speech.
[TsField("channel_name_phonetic")]
public string PhoneticName { get; protected set; }
/// Display name of the channel.
[TsField("channel_name")]
public string Name { get; protected set; }
/// Topic line shown below the channel name.
[TsField("channel_topic")]
public string Topic { get; protected set; }
/// Full description text of the channel.
[TsField("channel_description")]
public string Description { get; protected set; }
/// Hashed channel password; empty if no password is set.
[TsField("channel_password")]
public string PasswordHash { get; protected set; }
/// Codec used in this channel.
[TsField("channel_codec")]
public ChannelCodec Codec { get; protected set; }
/// Codec quality level from 0 (lowest) to 10 (highest).
[TsField("channel_codec_quality")]
public int CodecQuality { get; protected set; }
/// Codec latency factor; higher values increase audio latency.
[TsField("channel_codec_latency_factor")]
public int CodecLatencyFactor { get; protected set; }
/// Whether the channel's codec is unencrypted.
[TsField("channel_codec_is_unencrypted")]
public bool CodecIsUnencrypted { get; protected set; }
/// Security salt used for channel encryption.
[TsField("channel_security_salt")]
public string SecuritySalt { get; protected set; }
/// Maximum number of clients allowed in the channel; -1 means unlimited.
[TsField("channel_maxclients")]
public int MaxClients { get; protected set; }
/// Maximum number of clients allowed in this channel and all its sub-channels; -1 means unlimited.
[TsField("channel_maxfamilyclients")]
public int MaxFamilyClients { get; protected set; }
/// Sort order position relative to sibling channels; 0 means first.
[TsField("channel_order", "order")]
public int Order { get; protected set; }
/// Whether the channel persists after the last client leaves.
[TsField("channel_flag_permanent")]
public bool PermanentFlag { get; protected set; }
/// Whether the channel persists only until the server restarts.
[TsField("channel_flag_semi_permanent")]
public bool SemiPermanentFlag { get; protected set; }
/// Whether this is the default channel clients connect to on join.
[TsField("channel_flag_default")]
public bool DefaultFlag { get; protected set; }
/// Whether the channel is password protected.
[TsField("channel_flag_password")]
public bool PasswordFlag { get; protected set; }
/// Delay in seconds before a temporary channel is deleted after becoming empty.
[TsField("channel_delete_delay")]
public int DeleteDelay { get; protected set; }
/// Whether the client limit for this channel is unlimited.
[TsField("channel_flag_maxclients_unlimited")]
public bool UnlimitedClientsFlag { get; protected set; }
/// Whether the family client limit for this channel is unlimited.
[TsField("channel_flag_maxfamilyclients_unlimited")]
public bool UnlimitedFamilyClientsFlag { get; protected set; }
/// Whether the family client limit is inherited from the parent channel.
[TsField("channel_flag_maxfamilyclients_inherited")]
public bool MaxFamilyClientsInherited { get; protected set; }
/// Server-side file storage path for this channel.
[TsField("channel_filepath")]
public string FilePath { get; protected set; }
/// Minimum talk power a client must have to speak in this channel.
[TsField("channel_needed_talk_power")]
public int NeededTalkPower { get; protected set; }
/// Whether clients without sufficient talk power are force-silenced.
[TsField("channel_forced_silence")]
public bool ForcedSilence { get; protected set; }
/// Icon ID displayed next to the channel name.
[TsField("channel_icon_id")]
public ulong Icon { get; protected set; }
/// URL of the channel banner image.
[TsField("channel_banner_gfx_url")]
public string BannerGFXUrl { get; protected set; }
/// How the banner image is scaled in the client.
[TsField("channel_banner_mode")]
public BannerMode BannerMode { get; protected set; }
/// Seconds the channel has been empty; -1 if currently occupied or permanent.
[TsField("seconds_empty")]
public int SecondsEmpty { get; protected set; }
internal ChannelInfo(TsDataEntry data) : base(data) { }
///
public override string ToString() => $"Channel[{ID}] {Name}";
///
public override int GetHashCode() => ID.GetHashCode();
///
public override bool Equals(object obj) => obj is ChannelInfo && ID.Equals((obj as ChannelInfo).ID);
}
}