/**
 * Cloudflare ALERTING API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service alerting
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import { InternalServerError } from "../errors.js";
// =============================================================================
// Errors
// =============================================================================
export class FiltersRequired extends Schema.TaggedErrorClass()("FiltersRequired", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(FiltersRequired, [{ code: 17103 }]);
T.applyErrorMatchers(InternalServerError, [{ code: 15000 }]);
export class InvalidAlertType extends Schema.TaggedErrorClass()("InvalidAlertType", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidAlertType, [{ code: 17004 }]);
export class InvalidRoute extends Schema.TaggedErrorClass()("InvalidRoute", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidRoute, [{ code: 7003 }]);
export class InvalidWebhookId extends Schema.TaggedErrorClass()("InvalidWebhookId", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidWebhookId, [
    { code: 0, message: { includes: "invalid Webhook ID" } },
]);
export class MechanismRequired extends Schema.TaggedErrorClass()("MechanismRequired", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MechanismRequired, [{ code: 17102 }]);
export class PolicyNotFound extends Schema.TaggedErrorClass()("PolicyNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(PolicyNotFound, [
    { code: 0, message: { includes: "Policy not found" } },
]);
export class WebhookNotFound extends Schema.TaggedErrorClass()("WebhookNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(WebhookNotFound, [
    { code: 0, message: { includes: "Webhook not found" } },
]);
export class WebhookTestFailed extends Schema.TaggedErrorClass()("WebhookTestFailed", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(WebhookTestFailed, [
    { code: 0, message: { includes: "Webhook test failed" } },
]);
export const ListAvailableAlertsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/available_alerts",
}));
export const ListAvailableAlertsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Record(Schema.String, Schema.Unknown).pipe(T.ResponsePath("result"));
export const listAvailableAlerts = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListAvailableAlertsRequest,
    output: ListAvailableAlertsResponse,
    errors: [InvalidRoute],
}));
export const GetDestinationEligibleRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/destinations/eligible",
}));
export const GetDestinationEligibleResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Record(Schema.String, Schema.Unknown).pipe(T.ResponsePath("result"));
export const getDestinationEligible = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetDestinationEligibleRequest,
    output: GetDestinationEligibleResponse,
    errors: [InvalidRoute],
}));
export const GetDestinationPagerdutyRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/destinations/pagerduty",
}));
export const GetDestinationPagerdutyResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    })),
});
export const getDestinationPagerduty = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: GetDestinationPagerdutyRequest,
    output: GetDestinationPagerdutyResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateDestinationPagerdutyRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/alerting/v3/destinations/pagerduty/connect",
}));
export const CreateDestinationPagerdutyResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const createDestinationPagerduty = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateDestinationPagerdutyRequest,
    output: CreateDestinationPagerdutyResponse,
    errors: [InvalidRoute],
}));
export const DeleteDestinationPagerdutyRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/alerting/v3/destinations/pagerduty",
}));
export const DeleteDestinationPagerdutyResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    messages: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    success: Schema.Literal(true),
});
export const deleteDestinationPagerduty = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteDestinationPagerdutyRequest,
    output: DeleteDestinationPagerdutyResponse,
    errors: [InvalidRoute],
}));
export const LinkDestinationPagerdutyRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    tokenId: Schema.String.pipe(T.HttpPath("tokenId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/destinations/pagerduty/connect/{tokenId}",
}));
export const LinkDestinationPagerdutyResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const linkDestinationPagerduty = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: LinkDestinationPagerdutyRequest,
    output: LinkDestinationPagerdutyResponse,
    errors: [InvalidRoute],
}));
export const GetDestinationWebhookRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    webhookId: Schema.String.pipe(T.HttpPath("webhookId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhookId}",
}));
export const GetDestinationWebhookResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastFailure: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastSuccess: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    type: Schema.optional(Schema.Union([
        Schema.Literals([
            "datadog",
            "discord",
            "feishu",
            "gchat",
            "generic",
            "opsgenie",
            "slack",
            "splunk",
        ]),
        Schema.Null,
    ])),
    url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdAt: "created_at",
    lastFailure: "last_failure",
    lastSuccess: "last_success",
    name: "name",
    type: "type",
    url: "url",
}))
    .pipe(T.ResponsePath("result"));
export const getDestinationWebhook = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetDestinationWebhookRequest,
    output: GetDestinationWebhookResponse,
    errors: [InvalidRoute, WebhookNotFound],
}));
export const ListDestinationWebhooksRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/destinations/webhooks",
}));
export const ListDestinationWebhooksResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        lastFailure: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        lastSuccess: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        type: Schema.optional(Schema.Union([
            Schema.Literals([
                "datadog",
                "discord",
                "feishu",
                "gchat",
                "generic",
                "opsgenie",
                "slack",
                "splunk",
            ]),
            Schema.Null,
        ])),
        url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        createdAt: "created_at",
        lastFailure: "last_failure",
        lastSuccess: "last_success",
        name: "name",
        type: "type",
        url: "url",
    }))),
});
export const listDestinationWebhooks = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListDestinationWebhooksRequest,
    output: ListDestinationWebhooksResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateDestinationWebhookRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    url: Schema.String,
    secret: Schema.optional(Schema.String),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/alerting/v3/destinations/webhooks",
}));
export const CreateDestinationWebhookResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const createDestinationWebhook = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateDestinationWebhookRequest,
    output: CreateDestinationWebhookResponse,
    errors: [InvalidRoute, WebhookTestFailed],
}));
export const UpdateDestinationWebhookRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    webhookId: Schema.String.pipe(T.HttpPath("webhookId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    url: Schema.String,
    secret: Schema.optional(Schema.String),
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhookId}",
}));
export const UpdateDestinationWebhookResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const updateDestinationWebhook = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateDestinationWebhookRequest,
    output: UpdateDestinationWebhookResponse,
    errors: [InvalidRoute, InvalidWebhookId],
}));
export const DeleteDestinationWebhookRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    webhookId: Schema.String.pipe(T.HttpPath("webhookId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/alerting/v3/destinations/webhooks/{webhookId}",
}));
export const DeleteDestinationWebhookResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    messages: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    success: Schema.Literal(true),
});
export const deleteDestinationWebhook = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteDestinationWebhookRequest,
    output: DeleteDestinationWebhookResponse,
    errors: [InvalidRoute, InternalServerError],
}));
export const ListHistoriesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
    before: Schema.optional(Schema.String).pipe(T.HttpQuery("before")),
    since: Schema.optional(Schema.String).pipe(T.HttpQuery("since")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/alerting/v3/history" }));
export const ListHistoriesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        alertBody: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        alertType: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        mechanism: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        mechanismType: Schema.optional(Schema.Union([
            Schema.Literals(["email", "pagerduty", "webhook"]),
            Schema.Null,
        ])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        policyId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        sent: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        alertBody: "alert_body",
        alertType: "alert_type",
        description: "description",
        mechanism: "mechanism",
        mechanismType: "mechanism_type",
        name: "name",
        policyId: "policy_id",
        sent: "sent",
    }))),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            count: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            page: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            perPage: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            totalCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            count: "count",
            page: "page",
            perPage: "per_page",
            totalCount: "total_count",
        })),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({ result: "result", resultInfo: "result_info" }));
export const listHistories = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListHistoriesRequest,
    output: ListHistoriesResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const GetPolicyRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    policyId: Schema.String.pipe(T.HttpPath("policyId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/policies/{policyId}",
}));
export const GetPolicyResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    alertInterval: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    alertType: Schema.optional(Schema.Union([
        Schema.Literals([
            "abuse_report_alert",
            "access_custom_certificate_expiration_type",
            "advanced_ddos_attack_l4_alert",
            "advanced_ddos_attack_l7_alert",
            "advanced_http_alert_error",
            "bgp_hijack_notification",
            "billing_usage_alert",
            "block_notification_block_removed",
            "block_notification_new_block",
            "block_notification_review_rejected",
            "bot_traffic_basic_alert",
            "brand_protection_alert",
            "brand_protection_digest",
            "clickhouse_alert_fw_anomaly",
            "clickhouse_alert_fw_ent_anomaly",
            "cloudforce_one_request_notification",
            "custom_analytics",
            "custom_bot_detection_alert",
            "custom_ssl_certificate_event_type",
            "dedicated_ssl_certificate_event_type",
            "device_connectivity_anomaly_alert",
            "dos_attack_l4",
            "dos_attack_l7",
            "expiring_service_token_alert",
            "failing_logpush_job_disabled_alert",
            "fbm_auto_advertisement",
            "fbm_dosd_attack",
            "fbm_volumetric_attack",
            "health_check_status_notification",
            "hostname_aop_custom_certificate_expiration_type",
            "http_alert_edge_error",
            "http_alert_origin_error",
            "image_notification",
            "image_resizing_notification",
            "incident_alert",
            "load_balancing_health_alert",
            "load_balancing_pool_enablement_alert",
            "logo_match_alert",
            "magic_tunnel_health_check_event",
            "magic_wan_tunnel_health",
            "maintenance_event_notification",
            "mtls_certificate_store_certificate_expiration_type",
            "pages_event_alert",
            "radar_notification",
            "real_origin_monitoring",
            "scriptmonitor_alert_new_code_change_detections",
            "scriptmonitor_alert_new_hosts",
            "scriptmonitor_alert_new_malicious_hosts",
            "scriptmonitor_alert_new_malicious_scripts",
            "scriptmonitor_alert_new_malicious_url",
            "scriptmonitor_alert_new_max_length_resource_url",
            "scriptmonitor_alert_new_resources",
            "secondary_dns_all_primaries_failing",
            "secondary_dns_primaries_failing",
            "secondary_dns_warning",
            "secondary_dns_zone_successfully_updated",
            "secondary_dns_zone_validation_warning",
            "security_insights_alert",
            "sentinel_alert",
            "stream_live_notifications",
            "synthetic_test_latency_alert",
            "synthetic_test_low_availability_alert",
            "traffic_anomalies_alert",
            "tunnel_health_event",
            "tunnel_update_event",
            "universal_ssl_event_type",
            "web_analytics_metrics_update",
            "zone_aop_custom_certificate_expiration_type",
        ]),
        Schema.Null,
    ])),
    created: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    filters: Schema.optional(Schema.Union([
        Schema.Struct({
            actions: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            affectedAsns: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            affectedComponents: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            affectedLocations: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            airportCode: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            alertTriggerPreferences: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            alertTriggerPreferencesValue: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            enabled: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            environment: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            event: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            eventSource: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            eventType: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            groupBy: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            healthCheckId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            incidentImpact: Schema.optional(Schema.Union([
                Schema.Array(Schema.Literals([
                    "INCIDENT_IMPACT_NONE",
                    "INCIDENT_IMPACT_MINOR",
                    "INCIDENT_IMPACT_MAJOR",
                    "INCIDENT_IMPACT_CRITICAL",
                ])),
                Schema.Null,
            ])),
            inputId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            insightClass: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            limit: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            logoTag: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            megabitsPerSecond: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            newHealth: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            newStatus: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            packetsPerSecond: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            poolId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            popNames: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            product: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            projectId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            protocol: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            queryTag: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            requestsPerSecond: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            selectors: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            services: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            slo: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            status: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            targetHostname: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            targetIp: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            targetZoneName: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            trafficExclusions: Schema.optional(Schema.Union([
                Schema.Array(Schema.Literal("security_events")),
                Schema.Null,
            ])),
            tunnelId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            tunnelName: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            type: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            where: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            zones: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
        }).pipe(Schema.encodeKeys({
            actions: "actions",
            affectedAsns: "affected_asns",
            affectedComponents: "affected_components",
            affectedLocations: "affected_locations",
            airportCode: "airport_code",
            alertTriggerPreferences: "alert_trigger_preferences",
            alertTriggerPreferencesValue: "alert_trigger_preferences_value",
            enabled: "enabled",
            environment: "environment",
            event: "event",
            eventSource: "event_source",
            eventType: "event_type",
            groupBy: "group_by",
            healthCheckId: "health_check_id",
            incidentImpact: "incident_impact",
            inputId: "input_id",
            insightClass: "insight_class",
            limit: "limit",
            logoTag: "logo_tag",
            megabitsPerSecond: "megabits_per_second",
            newHealth: "new_health",
            newStatus: "new_status",
            packetsPerSecond: "packets_per_second",
            poolId: "pool_id",
            popNames: "pop_names",
            product: "product",
            projectId: "project_id",
            protocol: "protocol",
            queryTag: "query_tag",
            requestsPerSecond: "requests_per_second",
            selectors: "selectors",
            services: "services",
            slo: "slo",
            status: "status",
            targetHostname: "target_hostname",
            targetIp: "target_ip",
            targetZoneName: "target_zone_name",
            trafficExclusions: "traffic_exclusions",
            tunnelId: "tunnel_id",
            tunnelName: "tunnel_name",
            type: "type",
            where: "where",
            zones: "zones",
        })),
        Schema.Null,
    ])),
    mechanisms: Schema.optional(Schema.Union([
        Schema.Struct({
            email: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
            pagerduty: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
            webhooks: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
    modified: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    alertInterval: "alert_interval",
    alertType: "alert_type",
    created: "created",
    description: "description",
    enabled: "enabled",
    filters: "filters",
    mechanisms: "mechanisms",
    modified: "modified",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const getPolicy = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetPolicyRequest,
    output: GetPolicyResponse,
    errors: [InvalidRoute, PolicyNotFound],
}));
export const ListPoliciesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/policies",
}));
export const ListPoliciesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        alertInterval: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        alertType: Schema.optional(Schema.Union([
            Schema.Literals([
                "abuse_report_alert",
                "access_custom_certificate_expiration_type",
                "advanced_ddos_attack_l4_alert",
                "advanced_ddos_attack_l7_alert",
                "advanced_http_alert_error",
                "bgp_hijack_notification",
                "billing_usage_alert",
                "block_notification_block_removed",
                "block_notification_new_block",
                "block_notification_review_rejected",
                "bot_traffic_basic_alert",
                "brand_protection_alert",
                "brand_protection_digest",
                "clickhouse_alert_fw_anomaly",
                "clickhouse_alert_fw_ent_anomaly",
                "cloudforce_one_request_notification",
                "custom_analytics",
                "custom_bot_detection_alert",
                "custom_ssl_certificate_event_type",
                "dedicated_ssl_certificate_event_type",
                "device_connectivity_anomaly_alert",
                "dos_attack_l4",
                "dos_attack_l7",
                "expiring_service_token_alert",
                "failing_logpush_job_disabled_alert",
                "fbm_auto_advertisement",
                "fbm_dosd_attack",
                "fbm_volumetric_attack",
                "health_check_status_notification",
                "hostname_aop_custom_certificate_expiration_type",
                "http_alert_edge_error",
                "http_alert_origin_error",
                "image_notification",
                "image_resizing_notification",
                "incident_alert",
                "load_balancing_health_alert",
                "load_balancing_pool_enablement_alert",
                "logo_match_alert",
                "magic_tunnel_health_check_event",
                "magic_wan_tunnel_health",
                "maintenance_event_notification",
                "mtls_certificate_store_certificate_expiration_type",
                "pages_event_alert",
                "radar_notification",
                "real_origin_monitoring",
                "scriptmonitor_alert_new_code_change_detections",
                "scriptmonitor_alert_new_hosts",
                "scriptmonitor_alert_new_malicious_hosts",
                "scriptmonitor_alert_new_malicious_scripts",
                "scriptmonitor_alert_new_malicious_url",
                "scriptmonitor_alert_new_max_length_resource_url",
                "scriptmonitor_alert_new_resources",
                "secondary_dns_all_primaries_failing",
                "secondary_dns_primaries_failing",
                "secondary_dns_warning",
                "secondary_dns_zone_successfully_updated",
                "secondary_dns_zone_validation_warning",
                "security_insights_alert",
                "sentinel_alert",
                "stream_live_notifications",
                "synthetic_test_latency_alert",
                "synthetic_test_low_availability_alert",
                "traffic_anomalies_alert",
                "tunnel_health_event",
                "tunnel_update_event",
                "universal_ssl_event_type",
                "web_analytics_metrics_update",
                "zone_aop_custom_certificate_expiration_type",
            ]),
            Schema.Null,
        ])),
        created: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        filters: Schema.optional(Schema.Union([
            Schema.Struct({
                actions: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                affectedAsns: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                affectedComponents: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                affectedLocations: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                airportCode: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                alertTriggerPreferences: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                alertTriggerPreferencesValue: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                enabled: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                environment: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                event: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                eventSource: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                eventType: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                groupBy: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                healthCheckId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                incidentImpact: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Literals([
                        "INCIDENT_IMPACT_NONE",
                        "INCIDENT_IMPACT_MINOR",
                        "INCIDENT_IMPACT_MAJOR",
                        "INCIDENT_IMPACT_CRITICAL",
                    ])),
                    Schema.Null,
                ])),
                inputId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                insightClass: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                limit: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                logoTag: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                megabitsPerSecond: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                newHealth: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                newStatus: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                packetsPerSecond: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                poolId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                popNames: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                product: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                projectId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                protocol: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                queryTag: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                requestsPerSecond: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                selectors: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                services: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                slo: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                status: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                targetHostname: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                targetIp: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                targetZoneName: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                trafficExclusions: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Literal("security_events")),
                    Schema.Null,
                ])),
                tunnelId: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                tunnelName: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                type: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                where: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                zones: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                actions: "actions",
                affectedAsns: "affected_asns",
                affectedComponents: "affected_components",
                affectedLocations: "affected_locations",
                airportCode: "airport_code",
                alertTriggerPreferences: "alert_trigger_preferences",
                alertTriggerPreferencesValue: "alert_trigger_preferences_value",
                enabled: "enabled",
                environment: "environment",
                event: "event",
                eventSource: "event_source",
                eventType: "event_type",
                groupBy: "group_by",
                healthCheckId: "health_check_id",
                incidentImpact: "incident_impact",
                inputId: "input_id",
                insightClass: "insight_class",
                limit: "limit",
                logoTag: "logo_tag",
                megabitsPerSecond: "megabits_per_second",
                newHealth: "new_health",
                newStatus: "new_status",
                packetsPerSecond: "packets_per_second",
                poolId: "pool_id",
                popNames: "pop_names",
                product: "product",
                projectId: "project_id",
                protocol: "protocol",
                queryTag: "query_tag",
                requestsPerSecond: "requests_per_second",
                selectors: "selectors",
                services: "services",
                slo: "slo",
                status: "status",
                targetHostname: "target_hostname",
                targetIp: "target_ip",
                targetZoneName: "target_zone_name",
                trafficExclusions: "traffic_exclusions",
                tunnelId: "tunnel_id",
                tunnelName: "tunnel_name",
                type: "type",
                where: "where",
                zones: "zones",
            })),
            Schema.Null,
        ])),
        mechanisms: Schema.optional(Schema.Union([
            Schema.Struct({
                email: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    })),
                    Schema.Null,
                ])),
                pagerduty: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    })),
                    Schema.Null,
                ])),
                webhooks: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    })),
                    Schema.Null,
                ])),
            }),
            Schema.Null,
        ])),
        modified: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        alertInterval: "alert_interval",
        alertType: "alert_type",
        created: "created",
        description: "description",
        enabled: "enabled",
        filters: "filters",
        mechanisms: "mechanisms",
        modified: "modified",
        name: "name",
    }))),
});
export const listPolicies = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListPoliciesRequest,
    output: ListPoliciesResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreatePolicyRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    alertType: Schema.Literals([
        "abuse_report_alert",
        "access_custom_certificate_expiration_type",
        "advanced_ddos_attack_l4_alert",
        "advanced_ddos_attack_l7_alert",
        "advanced_http_alert_error",
        "bgp_hijack_notification",
        "billing_usage_alert",
        "block_notification_block_removed",
        "block_notification_new_block",
        "block_notification_review_rejected",
        "bot_traffic_basic_alert",
        "brand_protection_alert",
        "brand_protection_digest",
        "clickhouse_alert_fw_anomaly",
        "clickhouse_alert_fw_ent_anomaly",
        "cloudforce_one_request_notification",
        "custom_analytics",
        "custom_bot_detection_alert",
        "custom_ssl_certificate_event_type",
        "dedicated_ssl_certificate_event_type",
        "device_connectivity_anomaly_alert",
        "dos_attack_l4",
        "dos_attack_l7",
        "expiring_service_token_alert",
        "failing_logpush_job_disabled_alert",
        "fbm_auto_advertisement",
        "fbm_dosd_attack",
        "fbm_volumetric_attack",
        "health_check_status_notification",
        "hostname_aop_custom_certificate_expiration_type",
        "http_alert_edge_error",
        "http_alert_origin_error",
        "image_notification",
        "image_resizing_notification",
        "incident_alert",
        "load_balancing_health_alert",
        "load_balancing_pool_enablement_alert",
        "logo_match_alert",
        "magic_tunnel_health_check_event",
        "magic_wan_tunnel_health",
        "maintenance_event_notification",
        "mtls_certificate_store_certificate_expiration_type",
        "pages_event_alert",
        "radar_notification",
        "real_origin_monitoring",
        "scriptmonitor_alert_new_code_change_detections",
        "scriptmonitor_alert_new_hosts",
        "scriptmonitor_alert_new_malicious_hosts",
        "scriptmonitor_alert_new_malicious_scripts",
        "scriptmonitor_alert_new_malicious_url",
        "scriptmonitor_alert_new_max_length_resource_url",
        "scriptmonitor_alert_new_resources",
        "secondary_dns_all_primaries_failing",
        "secondary_dns_primaries_failing",
        "secondary_dns_warning",
        "secondary_dns_zone_successfully_updated",
        "secondary_dns_zone_validation_warning",
        "security_insights_alert",
        "sentinel_alert",
        "stream_live_notifications",
        "synthetic_test_latency_alert",
        "synthetic_test_low_availability_alert",
        "traffic_anomalies_alert",
        "tunnel_health_event",
        "tunnel_update_event",
        "universal_ssl_event_type",
        "web_analytics_metrics_update",
        "zone_aop_custom_certificate_expiration_type",
    ]),
    enabled: Schema.Boolean,
    mechanisms: Schema.Struct({
        email: Schema.optional(Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.String),
        }))),
        pagerduty: Schema.optional(Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.String),
        }))),
        webhooks: Schema.optional(Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.String),
        }))),
    }),
    name: Schema.String,
    alertInterval: Schema.optional(Schema.String),
    description: Schema.optional(Schema.String),
    filters: Schema.optional(Schema.Struct({
        actions: Schema.optional(Schema.Array(Schema.String)),
        affectedAsns: Schema.optional(Schema.Array(Schema.String)),
        affectedComponents: Schema.optional(Schema.Array(Schema.String)),
        affectedLocations: Schema.optional(Schema.Array(Schema.String)),
        airportCode: Schema.optional(Schema.Array(Schema.String)),
        alertTriggerPreferences: Schema.optional(Schema.Array(Schema.String)),
        alertTriggerPreferencesValue: Schema.optional(Schema.Array(Schema.String)),
        enabled: Schema.optional(Schema.Array(Schema.String)),
        environment: Schema.optional(Schema.Array(Schema.String)),
        event: Schema.optional(Schema.Array(Schema.String)),
        eventSource: Schema.optional(Schema.Array(Schema.String)),
        eventType: Schema.optional(Schema.Array(Schema.String)),
        groupBy: Schema.optional(Schema.Array(Schema.String)),
        healthCheckId: Schema.optional(Schema.Array(Schema.String)),
        incidentImpact: Schema.optional(Schema.Array(Schema.Literals([
            "INCIDENT_IMPACT_NONE",
            "INCIDENT_IMPACT_MINOR",
            "INCIDENT_IMPACT_MAJOR",
            "INCIDENT_IMPACT_CRITICAL",
        ]))),
        inputId: Schema.optional(Schema.Array(Schema.String)),
        insightClass: Schema.optional(Schema.Array(Schema.String)),
        limit: Schema.optional(Schema.Array(Schema.String)),
        logoTag: Schema.optional(Schema.Array(Schema.String)),
        megabitsPerSecond: Schema.optional(Schema.Array(Schema.String)),
        newHealth: Schema.optional(Schema.Array(Schema.String)),
        newStatus: Schema.optional(Schema.Array(Schema.String)),
        packetsPerSecond: Schema.optional(Schema.Array(Schema.String)),
        poolId: Schema.optional(Schema.Array(Schema.String)),
        popNames: Schema.optional(Schema.Array(Schema.String)),
        product: Schema.optional(Schema.Array(Schema.String)),
        projectId: Schema.optional(Schema.Array(Schema.String)),
        protocol: Schema.optional(Schema.Array(Schema.String)),
        queryTag: Schema.optional(Schema.Array(Schema.String)),
        requestsPerSecond: Schema.optional(Schema.Array(Schema.String)),
        selectors: Schema.optional(Schema.Array(Schema.String)),
        services: Schema.optional(Schema.Array(Schema.String)),
        slo: Schema.optional(Schema.Array(Schema.String)),
        status: Schema.optional(Schema.Array(Schema.String)),
        targetHostname: Schema.optional(Schema.Array(Schema.String)),
        targetIp: Schema.optional(Schema.Array(Schema.String)),
        targetZoneName: Schema.optional(Schema.Array(Schema.String)),
        trafficExclusions: Schema.optional(Schema.Array(Schema.Literal("security_events"))),
        tunnelId: Schema.optional(Schema.Array(Schema.String)),
        tunnelName: Schema.optional(Schema.Array(Schema.String)),
        type: Schema.optional(Schema.Array(Schema.String)),
        where: Schema.optional(Schema.Array(Schema.String)),
        zones: Schema.optional(Schema.Array(Schema.String)),
    }).pipe(Schema.encodeKeys({
        actions: "actions",
        affectedAsns: "affected_asns",
        affectedComponents: "affected_components",
        affectedLocations: "affected_locations",
        airportCode: "airport_code",
        alertTriggerPreferences: "alert_trigger_preferences",
        alertTriggerPreferencesValue: "alert_trigger_preferences_value",
        enabled: "enabled",
        environment: "environment",
        event: "event",
        eventSource: "event_source",
        eventType: "event_type",
        groupBy: "group_by",
        healthCheckId: "health_check_id",
        incidentImpact: "incident_impact",
        inputId: "input_id",
        insightClass: "insight_class",
        limit: "limit",
        logoTag: "logo_tag",
        megabitsPerSecond: "megabits_per_second",
        newHealth: "new_health",
        newStatus: "new_status",
        packetsPerSecond: "packets_per_second",
        poolId: "pool_id",
        popNames: "pop_names",
        product: "product",
        projectId: "project_id",
        protocol: "protocol",
        queryTag: "query_tag",
        requestsPerSecond: "requests_per_second",
        selectors: "selectors",
        services: "services",
        slo: "slo",
        status: "status",
        targetHostname: "target_hostname",
        targetIp: "target_ip",
        targetZoneName: "target_zone_name",
        trafficExclusions: "traffic_exclusions",
        tunnelId: "tunnel_id",
        tunnelName: "tunnel_name",
        type: "type",
        where: "where",
        zones: "zones",
    }))),
}).pipe(Schema.encodeKeys({
    alertType: "alert_type",
    enabled: "enabled",
    mechanisms: "mechanisms",
    name: "name",
    alertInterval: "alert_interval",
    description: "description",
    filters: "filters",
}), T.Http({
    method: "POST",
    path: "/accounts/{account_id}/alerting/v3/policies",
}));
export const CreatePolicyResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const createPolicy = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreatePolicyRequest,
    output: CreatePolicyResponse,
    errors: [InvalidRoute, FiltersRequired, MechanismRequired],
}));
export const UpdatePolicyRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    policyId: Schema.String.pipe(T.HttpPath("policyId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    alertInterval: Schema.optional(Schema.String),
    alertType: Schema.optional(Schema.Literals([
        "abuse_report_alert",
        "access_custom_certificate_expiration_type",
        "advanced_ddos_attack_l4_alert",
        "advanced_ddos_attack_l7_alert",
        "advanced_http_alert_error",
        "bgp_hijack_notification",
        "billing_usage_alert",
        "block_notification_block_removed",
        "block_notification_new_block",
        "block_notification_review_rejected",
        "bot_traffic_basic_alert",
        "brand_protection_alert",
        "brand_protection_digest",
        "clickhouse_alert_fw_anomaly",
        "clickhouse_alert_fw_ent_anomaly",
        "cloudforce_one_request_notification",
        "custom_analytics",
        "custom_bot_detection_alert",
        "custom_ssl_certificate_event_type",
        "dedicated_ssl_certificate_event_type",
        "device_connectivity_anomaly_alert",
        "dos_attack_l4",
        "dos_attack_l7",
        "expiring_service_token_alert",
        "failing_logpush_job_disabled_alert",
        "fbm_auto_advertisement",
        "fbm_dosd_attack",
        "fbm_volumetric_attack",
        "health_check_status_notification",
        "hostname_aop_custom_certificate_expiration_type",
        "http_alert_edge_error",
        "http_alert_origin_error",
        "image_notification",
        "image_resizing_notification",
        "incident_alert",
        "load_balancing_health_alert",
        "load_balancing_pool_enablement_alert",
        "logo_match_alert",
        "magic_tunnel_health_check_event",
        "magic_wan_tunnel_health",
        "maintenance_event_notification",
        "mtls_certificate_store_certificate_expiration_type",
        "pages_event_alert",
        "radar_notification",
        "real_origin_monitoring",
        "scriptmonitor_alert_new_code_change_detections",
        "scriptmonitor_alert_new_hosts",
        "scriptmonitor_alert_new_malicious_hosts",
        "scriptmonitor_alert_new_malicious_scripts",
        "scriptmonitor_alert_new_malicious_url",
        "scriptmonitor_alert_new_max_length_resource_url",
        "scriptmonitor_alert_new_resources",
        "secondary_dns_all_primaries_failing",
        "secondary_dns_primaries_failing",
        "secondary_dns_warning",
        "secondary_dns_zone_successfully_updated",
        "secondary_dns_zone_validation_warning",
        "security_insights_alert",
        "sentinel_alert",
        "stream_live_notifications",
        "synthetic_test_latency_alert",
        "synthetic_test_low_availability_alert",
        "traffic_anomalies_alert",
        "tunnel_health_event",
        "tunnel_update_event",
        "universal_ssl_event_type",
        "web_analytics_metrics_update",
        "zone_aop_custom_certificate_expiration_type",
    ])),
    description: Schema.optional(Schema.String),
    enabled: Schema.optional(Schema.Boolean),
    filters: Schema.optional(Schema.Struct({
        actions: Schema.optional(Schema.Array(Schema.String)),
        affectedAsns: Schema.optional(Schema.Array(Schema.String)),
        affectedComponents: Schema.optional(Schema.Array(Schema.String)),
        affectedLocations: Schema.optional(Schema.Array(Schema.String)),
        airportCode: Schema.optional(Schema.Array(Schema.String)),
        alertTriggerPreferences: Schema.optional(Schema.Array(Schema.String)),
        alertTriggerPreferencesValue: Schema.optional(Schema.Array(Schema.String)),
        enabled: Schema.optional(Schema.Array(Schema.String)),
        environment: Schema.optional(Schema.Array(Schema.String)),
        event: Schema.optional(Schema.Array(Schema.String)),
        eventSource: Schema.optional(Schema.Array(Schema.String)),
        eventType: Schema.optional(Schema.Array(Schema.String)),
        groupBy: Schema.optional(Schema.Array(Schema.String)),
        healthCheckId: Schema.optional(Schema.Array(Schema.String)),
        incidentImpact: Schema.optional(Schema.Array(Schema.Literals([
            "INCIDENT_IMPACT_NONE",
            "INCIDENT_IMPACT_MINOR",
            "INCIDENT_IMPACT_MAJOR",
            "INCIDENT_IMPACT_CRITICAL",
        ]))),
        inputId: Schema.optional(Schema.Array(Schema.String)),
        insightClass: Schema.optional(Schema.Array(Schema.String)),
        limit: Schema.optional(Schema.Array(Schema.String)),
        logoTag: Schema.optional(Schema.Array(Schema.String)),
        megabitsPerSecond: Schema.optional(Schema.Array(Schema.String)),
        newHealth: Schema.optional(Schema.Array(Schema.String)),
        newStatus: Schema.optional(Schema.Array(Schema.String)),
        packetsPerSecond: Schema.optional(Schema.Array(Schema.String)),
        poolId: Schema.optional(Schema.Array(Schema.String)),
        popNames: Schema.optional(Schema.Array(Schema.String)),
        product: Schema.optional(Schema.Array(Schema.String)),
        projectId: Schema.optional(Schema.Array(Schema.String)),
        protocol: Schema.optional(Schema.Array(Schema.String)),
        queryTag: Schema.optional(Schema.Array(Schema.String)),
        requestsPerSecond: Schema.optional(Schema.Array(Schema.String)),
        selectors: Schema.optional(Schema.Array(Schema.String)),
        services: Schema.optional(Schema.Array(Schema.String)),
        slo: Schema.optional(Schema.Array(Schema.String)),
        status: Schema.optional(Schema.Array(Schema.String)),
        targetHostname: Schema.optional(Schema.Array(Schema.String)),
        targetIp: Schema.optional(Schema.Array(Schema.String)),
        targetZoneName: Schema.optional(Schema.Array(Schema.String)),
        trafficExclusions: Schema.optional(Schema.Array(Schema.Literal("security_events"))),
        tunnelId: Schema.optional(Schema.Array(Schema.String)),
        tunnelName: Schema.optional(Schema.Array(Schema.String)),
        type: Schema.optional(Schema.Array(Schema.String)),
        where: Schema.optional(Schema.Array(Schema.String)),
        zones: Schema.optional(Schema.Array(Schema.String)),
    }).pipe(Schema.encodeKeys({
        actions: "actions",
        affectedAsns: "affected_asns",
        affectedComponents: "affected_components",
        affectedLocations: "affected_locations",
        airportCode: "airport_code",
        alertTriggerPreferences: "alert_trigger_preferences",
        alertTriggerPreferencesValue: "alert_trigger_preferences_value",
        enabled: "enabled",
        environment: "environment",
        event: "event",
        eventSource: "event_source",
        eventType: "event_type",
        groupBy: "group_by",
        healthCheckId: "health_check_id",
        incidentImpact: "incident_impact",
        inputId: "input_id",
        insightClass: "insight_class",
        limit: "limit",
        logoTag: "logo_tag",
        megabitsPerSecond: "megabits_per_second",
        newHealth: "new_health",
        newStatus: "new_status",
        packetsPerSecond: "packets_per_second",
        poolId: "pool_id",
        popNames: "pop_names",
        product: "product",
        projectId: "project_id",
        protocol: "protocol",
        queryTag: "query_tag",
        requestsPerSecond: "requests_per_second",
        selectors: "selectors",
        services: "services",
        slo: "slo",
        status: "status",
        targetHostname: "target_hostname",
        targetIp: "target_ip",
        targetZoneName: "target_zone_name",
        trafficExclusions: "traffic_exclusions",
        tunnelId: "tunnel_id",
        tunnelName: "tunnel_name",
        type: "type",
        where: "where",
        zones: "zones",
    }))),
    mechanisms: Schema.optional(Schema.Struct({
        email: Schema.optional(Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.String),
        }))),
        pagerduty: Schema.optional(Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.String),
        }))),
        webhooks: Schema.optional(Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.String),
        }))),
    })),
    name: Schema.optional(Schema.String),
}).pipe(Schema.encodeKeys({
    alertInterval: "alert_interval",
    alertType: "alert_type",
    description: "description",
    enabled: "enabled",
    filters: "filters",
    mechanisms: "mechanisms",
    name: "name",
}), T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/alerting/v3/policies/{policyId}",
}));
export const UpdatePolicyResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const updatePolicy = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdatePolicyRequest,
    output: UpdatePolicyResponse,
    errors: [InvalidRoute, PolicyNotFound, InvalidAlertType, MechanismRequired],
}));
export const DeletePolicyRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    policyId: Schema.String.pipe(T.HttpPath("policyId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/alerting/v3/policies/{policyId}",
}));
export const DeletePolicyResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            message: Schema.String,
            code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        })),
        Schema.Null,
    ])),
    messages: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            message: Schema.String,
            code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        })),
        Schema.Null,
    ])),
    success: Schema.optional(Schema.Union([Schema.Literal(true), Schema.Null])),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            count: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            page: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            perPage: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            totalCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            count: "count",
            page: "page",
            perPage: "per_page",
            totalCount: "total_count",
        })),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({
    errors: "errors",
    messages: "messages",
    success: "success",
    resultInfo: "result_info",
}));
export const deletePolicy = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeletePolicyRequest,
    output: DeletePolicyResponse,
    errors: [InvalidRoute, PolicyNotFound],
}));
export const GetSilenceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    silenceId: Schema.String.pipe(T.HttpPath("silenceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/silences/{silenceId}",
}));
export const GetSilenceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    endTime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policyId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    startTime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdAt: "created_at",
    endTime: "end_time",
    policyId: "policy_id",
    startTime: "start_time",
    updatedAt: "updated_at",
}))
    .pipe(T.ResponsePath("result"));
export const getSilence = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetSilenceRequest,
    output: GetSilenceResponse,
    errors: [InvalidRoute, InternalServerError],
}));
export const ListSilencesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/alerting/v3/silences",
}));
export const ListSilencesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        endTime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        policyId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        startTime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        createdAt: "created_at",
        endTime: "end_time",
        policyId: "policy_id",
        startTime: "start_time",
        updatedAt: "updated_at",
    }))),
});
export const listSilences = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListSilencesRequest,
    output: ListSilencesResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateSilenceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    body: Schema.Array(Schema.Struct({
        endTime: Schema.optional(Schema.String),
        policyId: Schema.optional(Schema.String),
        startTime: Schema.optional(Schema.String),
    }).pipe(Schema.encodeKeys({
        endTime: "end_time",
        policyId: "policy_id",
        startTime: "start_time",
    }))).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/alerting/v3/silences",
}));
export const CreateSilenceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    messages: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    success: Schema.Literal(true),
});
export const createSilence = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateSilenceRequest,
    output: CreateSilenceResponse,
    errors: [InvalidRoute],
}));
export const UpdateSilenceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    body: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.String),
        endTime: Schema.optional(Schema.String),
        startTime: Schema.optional(Schema.String),
    }).pipe(Schema.encodeKeys({
        id: "id",
        endTime: "end_time",
        startTime: "start_time",
    }))).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/alerting/v3/silences",
}));
export const UpdateSilenceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        endTime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        policyId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        startTime: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        createdAt: "created_at",
        endTime: "end_time",
        policyId: "policy_id",
        startTime: "start_time",
        updatedAt: "updated_at",
    }))),
});
export const updateSilence = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: UpdateSilenceRequest,
    output: UpdateSilenceResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const DeleteSilenceRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    silenceId: Schema.String.pipe(T.HttpPath("silenceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/alerting/v3/silences/{silenceId}",
}));
export const DeleteSilenceResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    messages: Schema.Array(Schema.Struct({
        message: Schema.String,
        code: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    })),
    success: Schema.Literal(true),
});
export const deleteSilence = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteSilenceRequest,
    output: DeleteSilenceResponse,
    errors: [InvalidRoute],
}));
//# sourceMappingURL=alerting.js.map