/**
 * Cloudflare DIAGNOSTICS API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service diagnostics
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import {} from "../errors.js";
export const GetEndpointHealthcheckRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String.pipe(T.HttpPath("id")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/diagnostics/endpoint-healthchecks/{id}",
}));
export const GetEndpointHealthcheckResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    checkType: Schema.Literal("icmp"),
    endpoint: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    checkType: "check_type",
    endpoint: "endpoint",
    id: "id",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const getEndpointHealthcheck = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetEndpointHealthcheckRequest,
    output: GetEndpointHealthcheckResponse,
    errors: [],
}));
export const ListEndpointHealthchecksRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/diagnostics/endpoint-healthchecks",
}));
export const ListEndpointHealthchecksResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    checkType: Schema.Literal("icmp"),
    endpoint: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    checkType: "check_type",
    endpoint: "endpoint",
    id: "id",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const listEndpointHealthchecks = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: ListEndpointHealthchecksRequest,
    output: ListEndpointHealthchecksResponse,
    errors: [],
}));
export const CreateEndpointHealthcheckRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    checkType: Schema.Literal("icmp"),
    endpoint: Schema.String,
    name: Schema.optional(Schema.String),
}).pipe(Schema.encodeKeys({
    checkType: "check_type",
    endpoint: "endpoint",
    name: "name",
}), T.Http({
    method: "POST",
    path: "/accounts/{account_id}/diagnostics/endpoint-healthchecks",
}));
export const CreateEndpointHealthcheckResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    checkType: Schema.Literal("icmp"),
    endpoint: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    checkType: "check_type",
    endpoint: "endpoint",
    id: "id",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const createEndpointHealthcheck = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateEndpointHealthcheckRequest,
    output: CreateEndpointHealthcheckResponse,
    errors: [],
}));
export const UpdateEndpointHealthcheckRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String.pipe(T.HttpPath("id")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    checkType: Schema.Literal("icmp"),
    endpoint: Schema.String,
    name: Schema.optional(Schema.String),
}).pipe(Schema.encodeKeys({
    checkType: "check_type",
    endpoint: "endpoint",
    name: "name",
}), T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/diagnostics/endpoint-healthchecks/{id}",
}));
export const UpdateEndpointHealthcheckResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    checkType: Schema.Literal("icmp"),
    endpoint: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    checkType: "check_type",
    endpoint: "endpoint",
    id: "id",
    name: "name",
}))
    .pipe(T.ResponsePath("result"));
export const updateEndpointHealthcheck = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateEndpointHealthcheckRequest,
    output: UpdateEndpointHealthcheckResponse,
    errors: [],
}));
export const DeleteEndpointHealthcheckRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String.pipe(T.HttpPath("id")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/diagnostics/endpoint-healthchecks/{id}",
}));
export const DeleteEndpointHealthcheckResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.Array(Schema.Struct({
        code: Schema.Number,
        message: Schema.String,
        documentationUrl: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        source: Schema.optional(Schema.Union([
            Schema.Struct({
                pointer: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        code: "code",
        message: "message",
        documentationUrl: "documentation_url",
        source: "source",
    }))),
    messages: Schema.Array(Schema.Struct({
        code: Schema.Number,
        message: Schema.String,
        documentationUrl: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        source: Schema.optional(Schema.Union([
            Schema.Struct({
                pointer: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        code: "code",
        message: "message",
        documentationUrl: "documentation_url",
        source: "source",
    }))),
    success: Schema.Literal(true),
});
export const deleteEndpointHealthcheck = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteEndpointHealthcheckRequest,
    output: DeleteEndpointHealthcheckResponse,
    errors: [],
}));
export const CreateTracerouteRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    targets: Schema.Array(Schema.String),
    colos: Schema.optional(Schema.Array(Schema.String)),
    options: Schema.optional(Schema.Struct({
        maxTtl: Schema.optional(Schema.Number),
        packetType: Schema.optional(Schema.Literals(["icmp", "tcp", "udp", "gre", "gre+icmp"])),
        packetsPerTtl: Schema.optional(Schema.Number),
        port: Schema.optional(Schema.Number),
        waitTime: Schema.optional(Schema.Number),
    }).pipe(Schema.encodeKeys({
        maxTtl: "max_ttl",
        packetType: "packet_type",
        packetsPerTtl: "packets_per_ttl",
        port: "port",
        waitTime: "wait_time",
    }))),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/diagnostics/traceroute",
}));
export const CreateTracerouteResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        colos: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                colo: Schema.optional(Schema.Union([
                    Schema.Struct({
                        city: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                error: Schema.optional(Schema.Union([
                    Schema.Literals([
                        "",
                        "Could not gather traceroute data: Code 1",
                        "Could not gather traceroute data: Code 2",
                        "Could not gather traceroute data: Code 3",
                        "Could not gather traceroute data: Code 4",
                    ]),
                    Schema.Null,
                ])),
                hops: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        nodes: Schema.optional(Schema.Union([
                            Schema.Array(Schema.Struct({
                                asn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                                ip: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                                labels: Schema.optional(Schema.Union([
                                    Schema.Array(Schema.String),
                                    Schema.Null,
                                ])),
                                maxRttMs: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                                meanRttMs: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                                minRttMs: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                                name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                                packetCount: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                                stdDevRttMs: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                            }).pipe(Schema.encodeKeys({
                                asn: "asn",
                                ip: "ip",
                                labels: "labels",
                                maxRttMs: "max_rtt_ms",
                                meanRttMs: "mean_rtt_ms",
                                minRttMs: "min_rtt_ms",
                                name: "name",
                                packetCount: "packet_count",
                                stdDevRttMs: "std_dev_rtt_ms",
                            }))),
                            Schema.Null,
                        ])),
                        packetsLost: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                        packetsSent: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                        packetsTtl: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                    }).pipe(Schema.encodeKeys({
                        nodes: "nodes",
                        packetsLost: "packets_lost",
                        packetsSent: "packets_sent",
                        packetsTtl: "packets_ttl",
                    }))),
                    Schema.Null,
                ])),
                targetSummary: Schema.optional(Schema.Union([Schema.Unknown, Schema.Null])),
                tracerouteTimeMs: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            }).pipe(Schema.encodeKeys({
                colo: "colo",
                error: "error",
                hops: "hops",
                targetSummary: "target_summary",
                tracerouteTimeMs: "traceroute_time_ms",
            }))),
            Schema.Null,
        ])),
        target: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    })),
});
export const createTraceroute = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: CreateTracerouteRequest,
    output: CreateTracerouteResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
//# sourceMappingURL=diagnostics.js.map