use super::{re, SecretPattern, Severity};

pub fn patterns() -> Vec<SecretPattern> {
    vec![
        SecretPattern {
            name: "Datadog API Key",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"(?i)dd[_-]?api[_-]?key\s*[:=]\s*[a-zA-Z0-9-]{32}\b"),
        },
        SecretPattern {
            name: "Datadog Application Key",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"(?i)dd[_-]?app(?:lication)?[_-]?key\s*[:=]\s*[a-zA-Z0-9-]{40}\b"),
        },
        SecretPattern {
            name: "New Relic User API Key",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bNRAK-[A-Z0-9]{27}\b"),
        },
        SecretPattern {
            name: "New Relic Admin Key (legacy)",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bNRAA-[A-F0-9]{27}\b"),
        },
        SecretPattern {
            name: "New Relic Insert Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bNRII-[A-Z0-9]{32}\b"),
        },
        SecretPattern {
            name: "New Relic Browser API Token",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bNRJS-[A-Z0-9]{19}\b"),
        },
        SecretPattern {
            name: "New Relic License Key",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\b[a-f0-9]{36}NRAL\b"),
        },
        SecretPattern {
            name: "Sentry Org Auth Token",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bsntrys_[A-Za-z0-9+/=]{60,}"),
        },
        SecretPattern {
            name: "Sentry User Auth Token",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bsntryu_[A-Fa-f0-9]{64}\b"),
        },
        SecretPattern {
            name: "Sentry DSN",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"https?://[a-f0-9]{32}@(?:o\d+\.)?ingest\.sentry\.io/\d+"),
        },
        SecretPattern {
            name: "Honeycomb API Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bhc[abcmpsu]ic_[a-z0-9]{58}\b"),
        },
        SecretPattern {
            name: "Grafana API Key (legacy)",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\beyJrIjoi[A-Za-z0-9_+/=]{40,}"),
        },
        SecretPattern {
            name: "Grafana Cloud API Token",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bglc_[A-Za-z0-9_+/=]{60,}"),
        },
        SecretPattern {
            name: "Grafana Service Account Token",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bglsa_[A-Za-z0-9]{32}_[a-f0-9]{8}\b"),
        },
        SecretPattern {
            name: "Sumologic Access ID",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"(?i)sumo[a-z0-9_-]*\s*[:=]\s*su[A-Za-z0-9]{12}\b"),
        },
        SecretPattern {
            name: "Sumologic Access Key",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"(?i)sumo[_-]?access[_-]?key\s*[:=]\s*[A-Za-z0-9]{64}\b"),
        },
        SecretPattern {
            name: "Dynatrace API Token",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bdt0c01\.[A-Z0-9]{24}\.[A-Z0-9]{64}\b"),
        },
        SecretPattern {
            name: "PagerDuty API Token",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"(?i)Token token=[A-Za-z0-9_+-]{20}\b"),
        },
        SecretPattern {
            name: "Opsgenie API Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(
                r"(?i)opsgenie[a-z0-9_-]*\s*[:=]\s*[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}",
            ),
        },
        SecretPattern {
            name: "Rollbar Access Token",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"(?i)rollbar[a-z0-9_-]*\s*[:=]\s*[a-f0-9]{32}\b"),
        },
        SecretPattern {
            name: "Bugsnag API Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"(?i)bugsnag[a-z0-9_-]*\s*[:=]\s*[a-f0-9]{32}\b"),
        },
        SecretPattern {
            name: "Mixpanel API Secret",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"(?i)mixpanel[a-z0-9_-]*\s*[:=]\s*[a-f0-9]{32}\b"),
        },
        SecretPattern {
            name: "Amplitude API Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"(?i)amplitude[a-z0-9_-]*\s*[:=]\s*[a-f0-9]{32}\b"),
        },
        SecretPattern {
            name: "Segment Write Key",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"(?i)segment[_-]?write[_-]?key\s*[:=]\s*[A-Za-z0-9]{32}\b"),
        },
        SecretPattern {
            name: "PostHog Project API Key",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"\bphc_[A-Za-z0-9]{43}\b"),
        },
        SecretPattern {
            name: "PostHog Personal API Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bphx_[A-Za-z0-9]{43}\b"),
        },
        SecretPattern {
            name: "Statsig Server Secret",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bsecret-[A-Za-z0-9]{40,}"),
        },
        SecretPattern {
            name: "LaunchDarkly SDK Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bsdk-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b"),
        },
        SecretPattern {
            name: "LaunchDarkly Mobile Key",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"\bmob-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b"),
        },
        SecretPattern {
            name: "LaunchDarkly Access Token (Personal)",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bapi-[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}\b"),
        },
        SecretPattern {
            name: "GrowthBook API Key",
            category: "Monitoring",
            severity: Severity::High,
            regex: re(r"\bsecret_[A-Za-z0-9]{32,}"),
        },
        SecretPattern {
            name: "LogRocket App ID",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"(?i)logrocket[a-z0-9_-]*\s*[:=]\s*[a-z0-9]{6}/[a-z0-9-]+\b"),
        },
        SecretPattern {
            name: "FullStory Org ID",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"(?i)fullstory[a-z0-9_-]*\s*[:=]\s*[A-Za-z0-9]{12}\b"),
        },
        SecretPattern {
            name: "Dynatrace Platform Token",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bdt0s(?:16|02|08)\.[A-Z0-9]{8}\.[A-Za-z0-9]{64}\b"),
        },
        SecretPattern {
            name: "Datadog RUM Client Token",
            category: "Monitoring",
            severity: Severity::Medium,
            regex: re(r"\bpub[0-9a-f]{32}\b"),
        },
        SecretPattern {
            name: "Statsig Console Key",
            category: "Monitoring",
            severity: Severity::Critical,
            regex: re(r"\bconsole-[A-Za-z0-9]{20,}\b"),
        },
    ]
}
