using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Runtime.Serialization; using System.Net; using ServiceStack.Text; using RestSharp; namespace UptimeSharp.Models { /// /// The Monitor Model implementation /// [DataContract] public class Monitor { /// /// Gets or sets the ID. /// /// /// The ID. /// [DataMember(Name = "id")] public int ID { get; set; } /// /// Gets or sets the name. /// /// /// The name. /// [DataMember(Name = "friendlyname")] public string Name { get; set; } /// /// Gets or sets the URI. /// /// /// The URI. /// [DataMember(Name = "url")] public string UriString { get; set; } /// /// Gets the URI. /// /// /// The URI. /// [IgnoreDataMember] public Uri Uri { get { Uri uri; try { uri = new Uri(UriString); } catch { uri = null; } return uri; } } /// /// Gets or sets the port. /// Only for port monitoring. /// /// /// The port. /// [DataMember(Name = "port")] public int? Port { get; set; } /// /// Gets or sets the uptime. /// /// /// Uptime ratio of the monitor calculated since the monitor is created. /// [DataMember(Name = "alltimeuptimeratio")] public float Uptime { get; set; } /// /// Gets or sets the uptime custom. /// /// /// The uptime ratio of the monitor for the given periods /// [DataMember(Name = "customuptimeratio")] public float? UptimeCustom { get; set; } /// /// Gets or sets the HTTP password. /// /// /// The HTTP password. /// [DataMember(Name = "httppassword")] public string HTTPPassword { get; set; } /// /// Gets or sets the HTTP username. /// /// /// The HTTP username. /// [DataMember(Name = "httpusername")] public string HTTPUsername { get; set; } /// /// Gets or sets the type of the keyword. /// /// /// The type of the keyword. /// [DataMember(Name = "keywordtype")] public KeywordType KeywordType { get; set; } /// /// Gets or sets the keyword value. /// /// /// The keyword value. /// [DataMember(Name = "keywordvalue")] public string KeywordValue { get; set; } /// /// Gets or sets the status. /// /// /// The status. /// [DataMember(Name = "status")] public Status Status { get; set; } /// /// Gets or sets the type. /// /// /// The type. /// [DataMember(Name = "type")] public Type Type { get; set; } /// /// Gets or sets the subtype. /// /// /// The subtype. /// [DataMember(Name = "subtype")] public Subtype Subtype { get; set; } /// /// Gets or sets the alerts. /// /// /// The alert contacts. /// [DataMember(Name = "alertcontact")] public List Alerts { get; set; } /// /// Gets or sets the log. /// /// /// The log with dates and associated alert contacts. /// [DataMember(Name = "log")] public List Log { get; set; } } /// /// The status of the monitor /// public enum Status { /// /// Paused /// Pause = 0, /// /// Not checked yet /// NotChecked = 1, /// /// Up /// Up = 2, /// /// Seems down /// SeemsDown = 8, /// /// Down /// Down = 9 } /// /// The type of the monitor /// public enum Type { /// /// HTTP /// HTTP = 1, /// /// Keyword /// Keyword = 2, /// /// Ping /// Ping = 3, /// /// Port /// Port = 4 } /// /// Shows which pre-defined port/service is monitored or if a custom port is monitored. /// public enum Subtype { /// /// Unknown /// Unknown, /// /// HTTP /// HTTP = 1, /// /// HTTPS /// HTTPS = 2, /// /// FTP /// FTP = 3, /// /// SMTP /// SMTP = 4, /// /// POP3 /// POP3 = 5, /// /// IMAP /// IMAP = 6, /// /// Custom Port /// Custom = 99 } /// /// Shows if the monitor will be flagged as down when the keyword exists or not exists /// public enum KeywordType { /// /// Unknown /// Unknown, /// /// Exists /// Exists = 1, /// /// Exists not /// NotExists = 2 } }