import type { ListmonkClient } from "@listmonk-ops/openapi"; import type { ProviderInspector, ProviderProfile, SesAccountSnapshot, SesIdentitySnapshot } from "./provider-profiles.js"; export type DoctorCheckStatus = "pass" | "warn" | "fail" | "unknown"; export interface DoctorCheck { id: string; status: DoctorCheckStatus; message: string; details?: Readonly> | undefined; } export interface ProviderProfileSummary { id: string; kind: ProviderProfile["kind"]; messenger: string; sending_domain: string; from_email?: string | undefined; region?: string | undefined; smtp_hosts: string[]; webhook_source: string; credential_reference_configured: boolean; } export interface ProviderListmonkSnapshot { from_email?: string | undefined; from_domain?: string | undefined; messenger: string; messenger_binding_ambiguous: boolean; messenger_configured: boolean; messenger_enabled: boolean; smtp_hosts: string[]; enabled_smtp_hosts: string[]; matching_smtp_hosts: string[]; smtp_configured: boolean; smtp_enabled: boolean; smtp_pool_exact: boolean; smtp_credential_binding_required: boolean; smtp_credentials_bound: boolean; unsubscribe_header_enabled: boolean; bounce_processing_enabled: boolean; bounce_webhooks_enabled: boolean; provider_bounce_enabled?: boolean | undefined; } export interface ProviderApiProbe { supported: boolean; reachable: boolean; authenticated: boolean; latency_ms?: number | undefined; error_code?: string | undefined; error_message?: string | undefined; } export interface ProviderStatusSnapshot { provider: ProviderProfileSummary; health: "healthy" | "degraded" | "unavailable"; checked_at: string; api: ProviderApiProbe; account?: SesAccountSnapshot | undefined; identity?: SesIdentitySnapshot | undefined; listmonk?: ProviderListmonkSnapshot | undefined; checks: DoctorCheck[]; } export interface ProviderQuotaSnapshot { provider_id: string; supported: boolean; checked_at: string; max_24_hour_send?: number | undefined; max_send_rate?: number | undefined; sent_last_24_hours?: number | undefined; remaining_24_hours?: number | undefined; utilization_percent?: number | undefined; production_access_enabled?: boolean | undefined; sending_enabled?: boolean | undefined; enforcement_status?: string | undefined; } export interface ProviderWebhookSnapshot { provider_id: string; source: string; evidence_scope: "profile" | "shared"; checked_at: string; max_age_hours: number; bounce_processing_enabled: boolean; bounce_webhooks_enabled: boolean; provider_bounce_enabled?: boolean | undefined; last_event_at?: string | undefined; last_event_type?: string | undefined; freshness: "fresh" | "stale" | "unknown"; healthy: boolean; checks: DoctorCheck[]; } export interface DnsObservation { name: string; type: "TXT" | "CNAME" | "MX"; values: string[]; error?: string | undefined; } export interface ProviderDnsSnapshot { provider_id: string; sending_domain: string; from_domain: string; mail_from_domain?: string | undefined; checked_at: string; observations: DnsObservation[]; checks: DoctorCheck[]; healthy: boolean; } export interface ProviderDoctorSnapshot { provider_id: string; checked_at: string; ready: boolean; summary: { pass: number; warn: number; fail: number; unknown: number; }; status: ProviderStatusSnapshot; quota: ProviderQuotaSnapshot; webhook: ProviderWebhookSnapshot; dns: ProviderDnsSnapshot; checks: DoctorCheck[]; } export interface ProviderDnsResolver { txt(name: string): Promise; cname(name: string): Promise; mx(name: string): Promise>; a?(name: string): Promise; aaaa?(name: string): Promise; } export interface ProviderInspectionContext { client?: Pick | undefined; inspector?: ProviderInspector | undefined; profiles?: readonly ProviderProfile[] | undefined; dns?: ProviderDnsResolver | undefined; dnsInspectionTimeoutMs?: number | undefined; now?: (() => Date) | undefined; } export declare function summarizeProviderProfile(profile: ProviderProfile): ProviderProfileSummary; export declare function inspectListmonkProviderSettings(profile: ProviderProfile, settings: Readonly>, profiles?: readonly ProviderProfile[]): ProviderListmonkSnapshot; export declare function inspectProviderStatus(profile: ProviderProfile, context: ProviderInspectionContext): Promise; export declare function testProviderApi(profile: ProviderProfile, context: ProviderInspectionContext): Promise; export declare function inspectProviderQuota(profile: ProviderProfile, context: ProviderInspectionContext): Promise; export declare function inspectProviderWebhook(profile: ProviderProfile, context: ProviderInspectionContext, maxAgeHours?: number): Promise; export declare function createNodeDnsResolver(timeoutMs?: number): ProviderDnsResolver; export declare function inspectProviderDns(profile: ProviderProfile, context: ProviderInspectionContext, identity?: SesIdentitySnapshot, fromDomainOverride?: string): Promise; export declare function runProviderDoctor(profile: ProviderProfile, context: ProviderInspectionContext, maxWebhookAgeHours?: number): Promise;