import BadDataException from "../Exception/BadDataException";
import IconProp from "../Icon/IconProp";
var MonitorType;
(function (MonitorType) {
    MonitorType["Manual"] = "Manual";
    MonitorType["Website"] = "Website";
    MonitorType["API"] = "API";
    MonitorType["Ping"] = "Ping";
    MonitorType["Kubernetes"] = "Kubernetes";
    MonitorType["Docker"] = "Docker";
    MonitorType["IP"] = "IP";
    MonitorType["IncomingRequest"] = "Incoming Request";
    MonitorType["IncomingEmail"] = "Incoming Email";
    MonitorType["Port"] = "Port";
    MonitorType["Server"] = "Server";
    MonitorType["SSLCertificate"] = "SSL Certificate";
    // These two monitor types are same but we are keeping them separate for now - this is for marketing purposes
    MonitorType["SyntheticMonitor"] = "Synthetic Monitor";
    MonitorType["CustomJavaScriptCode"] = "Custom JavaScript Code";
    // Telemetry monitor types
    MonitorType["Logs"] = "Logs";
    MonitorType["Metrics"] = "Metrics";
    MonitorType["Traces"] = "Traces";
    MonitorType["Exceptions"] = "Exceptions";
    MonitorType["Profiles"] = "Profiles";
    // Network device monitoring
    MonitorType["SNMP"] = "SNMP";
    // DNS monitoring
    MonitorType["DNS"] = "DNS";
    // DNSSEC validation monitoring
    MonitorType["DNSSEC"] = "DNSSEC";
    // Domain registration monitoring
    MonitorType["Domain"] = "Domain";
    // External status page monitoring
    MonitorType["ExternalStatusPage"] = "External Status Page";
})(MonitorType || (MonitorType = {}));
export default MonitorType;
export class MonitorTypeHelper {
    static getMonitorTypeCategories() {
        return [
            {
                label: "Basic Monitoring",
                monitorTypes: [
                    MonitorType.Website,
                    MonitorType.API,
                    MonitorType.Ping,
                    MonitorType.IP,
                    MonitorType.Port,
                    MonitorType.SSLCertificate,
                    MonitorType.Domain,
                    MonitorType.ExternalStatusPage,
                ],
            },
            {
                label: "DNS Monitoring",
                monitorTypes: [MonitorType.DNS, MonitorType.DNSSEC],
            },
            {
                label: "Synthetic Monitoring",
                monitorTypes: [
                    MonitorType.SyntheticMonitor,
                    MonitorType.CustomJavaScriptCode,
                ],
            },
            {
                label: "Inbound Monitoring",
                monitorTypes: [MonitorType.IncomingRequest, MonitorType.IncomingEmail],
            },
            {
                label: "Infrastructure",
                monitorTypes: [MonitorType.SNMP],
            },
            {
                label: "Kubernetes",
                monitorTypes: [MonitorType.Kubernetes],
            },
            {
                label: "Docker",
                monitorTypes: [MonitorType.Docker],
            },
            {
                label: "Telemetry",
                monitorTypes: [
                    MonitorType.Logs,
                    MonitorType.Metrics,
                    MonitorType.Traces,
                    MonitorType.Exceptions,
                    /*
                     * MonitorType.Profiles is intentionally not offered here: the
                     * dashboard has no configuration form for the profile monitor
                     * step, so a Profiles monitor created from this picker would have
                     * no profileMonitor config and could never evaluate. Existing
                     * Profiles monitors keep working — the enum value, its props in
                     * getAllMonitorTypeProps, and worker-side evaluation all remain.
                     */
                ],
            },
            {
                label: "Other",
                monitorTypes: [MonitorType.Manual],
            },
        ];
    }
    static isTelemetryMonitor(monitorType) {
        return (monitorType === MonitorType.Logs ||
            monitorType === MonitorType.Metrics ||
            monitorType === MonitorType.Traces ||
            monitorType === MonitorType.Exceptions ||
            monitorType === MonitorType.Profiles ||
            monitorType === MonitorType.Kubernetes ||
            monitorType === MonitorType.Docker);
    }
    static isManualMonitor(monitorType) {
        return monitorType === MonitorType.Manual;
    }
    static getAllMonitorTypeProps() {
        const monitorTypeProps = [
            {
                monitorType: MonitorType.API,
                title: "API",
                description: "This monitor type lets you monitor any API - GET, POST, PUT, DELETE or more.",
                icon: IconProp.Code,
            },
            {
                monitorType: MonitorType.Manual,
                title: "Manual",
                description: "This monitor is a static monitor and will not actually monitor anything. It will however help you to integrate OneUptime with external monitoring tools and utilities.",
                icon: IconProp.EmptyCircle,
            },
            {
                monitorType: MonitorType.Website,
                title: "Website",
                description: "This monitor type lets you monitor landing pages like home page of your company / blog or more.",
                icon: IconProp.Globe,
            },
            {
                monitorType: MonitorType.Ping,
                title: "Ping",
                description: "This monitor type does the basic ping test of an endpoint.",
                icon: IconProp.Signal,
            },
            {
                monitorType: MonitorType.Kubernetes,
                title: "Kubernetes",
                description: "This monitor type lets you monitor Kubernetes clusters, workloads, nodes, and pods.",
                icon: IconProp.Cube,
            },
            {
                monitorType: MonitorType.Docker,
                title: "Docker Container",
                description: "This monitor type lets you monitor Docker containers — CPU, memory, network, restarts, and lifecycle events.",
                icon: IconProp.Cube,
            },
            {
                monitorType: MonitorType.IP,
                title: "IP",
                description: "This monitor type lets you monitor any IPv4 or IPv6 addresses.",
                icon: IconProp.AltGlobe,
            },
            {
                monitorType: MonitorType.IncomingRequest,
                title: "Incoming Request",
                description: "This monitor type lets you ping OneUptime from any external device or service with a custom payload.",
                icon: IconProp.Webhook,
            },
            {
                monitorType: MonitorType.IncomingEmail,
                title: "Incoming Email",
                description: "This monitor type triggers alerts when emails are received at a unique email address with matching criteria.",
                icon: IconProp.Email,
            },
            {
                monitorType: MonitorType.Port,
                title: "Port",
                description: "This monitor type lets you monitor any TCP or UDP port.",
                icon: IconProp.Terminal,
            },
            {
                monitorType: MonitorType.Server,
                title: "Server / VM",
                description: "This monitor type lets you monitor any server, VM, or any machine.",
                icon: IconProp.Cube,
            },
            {
                monitorType: MonitorType.SSLCertificate,
                title: "SSL Certificate",
                description: "This monitor type lets you monitor SSL certificates of any domain.",
                icon: IconProp.ShieldCheck,
            },
            {
                monitorType: MonitorType.SyntheticMonitor,
                title: "Synthetic Monitor",
                description: "This monitor type lets you monitor your web application UI.",
                icon: IconProp.Window,
            },
            {
                monitorType: MonitorType.CustomJavaScriptCode,
                title: "Custom JavaScript Code",
                description: "This monitor type lets you run custom JavaScript code on a schedule.",
                icon: IconProp.Code,
            },
            {
                monitorType: MonitorType.Logs,
                title: "Logs",
                description: "This monitor type lets you monitor logs from any source.",
                icon: IconProp.Logs,
            },
            {
                monitorType: MonitorType.Exceptions,
                title: "Exceptions",
                description: "This monitor type lets you monitor exceptions and error groups from any source.",
                icon: IconProp.Bug,
            },
            {
                monitorType: MonitorType.Traces,
                title: "Traces",
                description: "This monitor type lets you monitor traces from any source.",
                icon: IconProp.Waterfall,
            },
            {
                monitorType: MonitorType.Metrics,
                title: "Metrics",
                description: "This monitor type lets you monitor metrics from any source.",
                icon: IconProp.Heartbeat,
            },
            {
                monitorType: MonitorType.Profiles,
                title: "Profiles",
                description: "This monitor type lets you monitor continuous profiling data from any source.",
                icon: IconProp.Fire,
            },
            {
                monitorType: MonitorType.SNMP,
                title: "SNMP",
                description: "This monitor type lets you monitor network devices like switches, routers, and firewalls via SNMP.",
                icon: IconProp.Signal,
            },
            {
                monitorType: MonitorType.DNS,
                title: "DNS",
                description: "This monitor type lets you monitor DNS resolution for your domains, verify record values, and check DNSSEC validity.",
                icon: IconProp.GlobeAlt,
            },
            {
                monitorType: MonitorType.DNSSEC,
                title: "DNSSEC",
                description: "This monitor type performs full DNSSEC validation — DNSKEY, DS at the parent zone, RRSIG validity windows, AD-flag/SERVFAIL behavior across public resolvers, and primary/secondary nameserver consistency.",
                icon: IconProp.Key,
            },
            {
                monitorType: MonitorType.Domain,
                title: "Domain",
                description: "This monitor type lets you monitor domain registration health — expiry dates, registrar info, nameserver delegation, and WHOIS status.",
                icon: IconProp.Globe,
            },
            {
                monitorType: MonitorType.ExternalStatusPage,
                title: "External Status Page",
                description: "This monitor type lets you monitor third-party status pages (e.g. AWS, GCP, Azure, GitHub, Cloudflare) and alert when their services degrade.",
                icon: IconProp.ExternalLink,
            },
        ];
        return monitorTypeProps;
    }
    static getDescription(monitorType) {
        const monitorTypeProps = this.getAllMonitorTypeProps().filter((item) => {
            return item.monitorType === monitorType;
        });
        if (!monitorTypeProps[0]) {
            throw new BadDataException(`${monitorType} does not have monitorType props`);
        }
        return monitorTypeProps[0].description;
    }
    static getTitle(monitorType) {
        const monitorTypeProps = this.getAllMonitorTypeProps().filter((item) => {
            return item.monitorType === monitorType;
        });
        if (!monitorTypeProps[0]) {
            throw new BadDataException(`${monitorType} does not have monitorType props`);
        }
        return monitorTypeProps[0].title;
    }
    static isProbableMonitor(monitorType) {
        const isProbeableMonitor = monitorType === MonitorType.API ||
            monitorType === MonitorType.Website ||
            monitorType === MonitorType.IP ||
            monitorType === MonitorType.Ping ||
            monitorType === MonitorType.Port ||
            monitorType === MonitorType.SSLCertificate ||
            monitorType === MonitorType.SyntheticMonitor ||
            monitorType === MonitorType.CustomJavaScriptCode ||
            monitorType === MonitorType.SNMP ||
            monitorType === MonitorType.DNS ||
            monitorType === MonitorType.DNSSEC ||
            monitorType === MonitorType.Domain ||
            monitorType === MonitorType.ExternalStatusPage;
        return isProbeableMonitor;
    }
    static getActiveMonitorTypes() {
        return [
            MonitorType.API,
            MonitorType.Website,
            MonitorType.IP,
            MonitorType.Ping,
            MonitorType.Port,
            MonitorType.SSLCertificate,
            MonitorType.SyntheticMonitor,
            MonitorType.CustomJavaScriptCode,
            MonitorType.IncomingRequest,
            MonitorType.IncomingEmail,
            MonitorType.Server,
            MonitorType.Logs,
            MonitorType.Metrics,
            MonitorType.Traces,
            MonitorType.Exceptions,
            MonitorType.Profiles,
            MonitorType.SNMP,
            MonitorType.DNS,
            MonitorType.DNSSEC,
            MonitorType.Domain,
            MonitorType.ExternalStatusPage,
            MonitorType.Kubernetes,
            MonitorType.Docker,
        ];
    }
    static doesMonitorTypeHaveDocumentation(monitorType) {
        return (monitorType === MonitorType.IncomingRequest ||
            monitorType === MonitorType.IncomingEmail ||
            monitorType === MonitorType.Server);
    }
    static doesMonitorTypeHaveInterval(monitorType) {
        return this.isProbableMonitor(monitorType);
    }
    static doesMonitorTypeHaveCriteria(monitorType) {
        return monitorType !== MonitorType.Manual;
    }
    static doesMonitorTypeHaveGraphs(monitorType) {
        if (monitorType === MonitorType.Website ||
            monitorType === MonitorType.API ||
            monitorType === MonitorType.IP ||
            monitorType === MonitorType.Ping ||
            monitorType === MonitorType.Port ||
            monitorType === MonitorType.Server ||
            monitorType === MonitorType.SSLCertificate ||
            monitorType === MonitorType.SyntheticMonitor ||
            monitorType === MonitorType.CustomJavaScriptCode ||
            monitorType === MonitorType.SNMP ||
            monitorType === MonitorType.DNS ||
            monitorType === MonitorType.DNSSEC ||
            monitorType === MonitorType.Domain ||
            monitorType === MonitorType.ExternalStatusPage) {
            return true;
        }
        return false;
    }
}
//# sourceMappingURL=MonitorType.js.map