/**
 * Cloudflare CONNECTIVITY API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service connectivity
 */
import * as Schema from "effect/Schema";
import * as API from "../client/api.js";
import * as T from "../traits.js";
import {} from "../errors.js";
// =============================================================================
// Errors
// =============================================================================
export class VpcServiceNameAlreadyExists extends Schema.TaggedErrorClass()("VpcServiceNameAlreadyExists", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(VpcServiceNameAlreadyExists, [
    { code: 5101, message: { includes: "already exists" } },
]);
export class VpcServiceNotFound extends Schema.TaggedErrorClass()("VpcServiceNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(VpcServiceNotFound, [{ code: 5104 }]);
export class VpcTunnelNotFound extends Schema.TaggedErrorClass()("VpcTunnelNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(VpcTunnelNotFound, [
    { code: 5101, message: { includes: "Tunnel ID Not Found" } },
]);
export const GetDirectoryServiceRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    serviceId: Schema.String.pipe(T.HttpPath("serviceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/connectivity/directory/services/{serviceId}",
}));
export const GetDirectoryServiceResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    host: Schema.Union([
        Schema.Struct({
            ipv4: Schema.String,
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv4: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            hostname: Schema.String,
            resolverNetwork: Schema.Struct({
                tunnelId: Schema.String,
                resolverIps: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                tunnelId: "tunnel_id",
                resolverIps: "resolver_ips",
            })),
        }).pipe(Schema.encodeKeys({
            hostname: "hostname",
            resolverNetwork: "resolver_network",
        })),
    ]),
    name: Schema.String,
    type: Schema.Literal("http"),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    httpPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    httpsPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    serviceId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    host: "host",
    name: "name",
    type: "type",
    createdAt: "created_at",
    httpPort: "http_port",
    httpsPort: "https_port",
    serviceId: "service_id",
    updatedAt: "updated_at",
}))
    .pipe(T.ResponsePath("result"));
export const getDirectoryService = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetDirectoryServiceRequest,
    output: GetDirectoryServiceResponse,
    errors: [VpcServiceNotFound],
}));
export const ListDirectoryServicesRequest = 
/*@__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")),
    type: Schema.optional(Schema.Union([Schema.Literal("http"), Schema.Null])).pipe(T.HttpQuery("type")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/connectivity/directory/services",
}));
export const ListDirectoryServicesResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        host: Schema.Union([
            Schema.Struct({
                ipv4: Schema.String,
                ipv6: Schema.String,
                network: Schema.Struct({
                    tunnelId: Schema.String,
                }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
            }),
            Schema.Struct({
                ipv4: Schema.String,
                network: Schema.Struct({
                    tunnelId: Schema.String,
                }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
            }),
            Schema.Struct({
                ipv6: Schema.String,
                network: Schema.Struct({
                    tunnelId: Schema.String,
                }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
            }),
            Schema.Struct({
                hostname: Schema.String,
                resolverNetwork: Schema.Struct({
                    tunnelId: Schema.String,
                    resolverIps: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({
                    tunnelId: "tunnel_id",
                    resolverIps: "resolver_ips",
                })),
            }).pipe(Schema.encodeKeys({
                hostname: "hostname",
                resolverNetwork: "resolver_network",
            })),
        ]),
        name: Schema.String,
        type: Schema.Literal("http"),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        httpPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        httpsPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        serviceId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        host: "host",
        name: "name",
        type: "type",
        createdAt: "created_at",
        httpPort: "http_port",
        httpsPort: "https_port",
        serviceId: "service_id",
        updatedAt: "updated_at",
    }))),
    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 listDirectoryServices = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListDirectoryServicesRequest,
    output: ListDirectoryServicesResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateDirectoryServiceRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    host: Schema.Union([
        Schema.Struct({
            ipv4: Schema.String,
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv4: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            hostname: Schema.String,
            resolverNetwork: Schema.Struct({
                tunnelId: Schema.String,
                resolverIps: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                tunnelId: "tunnel_id",
                resolverIps: "resolver_ips",
            })),
        }).pipe(Schema.encodeKeys({
            hostname: "hostname",
            resolverNetwork: "resolver_network",
        })),
    ]),
    name: Schema.String,
    type: Schema.Literal("http"),
    httpPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    httpsPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(Schema.encodeKeys({
    host: "host",
    name: "name",
    type: "type",
    httpPort: "http_port",
    httpsPort: "https_port",
}), T.Http({
    method: "POST",
    path: "/accounts/{account_id}/connectivity/directory/services",
}));
export const CreateDirectoryServiceResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    host: Schema.Union([
        Schema.Struct({
            ipv4: Schema.String,
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv4: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            hostname: Schema.String,
            resolverNetwork: Schema.Struct({
                tunnelId: Schema.String,
                resolverIps: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                tunnelId: "tunnel_id",
                resolverIps: "resolver_ips",
            })),
        }).pipe(Schema.encodeKeys({
            hostname: "hostname",
            resolverNetwork: "resolver_network",
        })),
    ]),
    name: Schema.String,
    type: Schema.Literal("http"),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    httpPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    httpsPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    serviceId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    host: "host",
    name: "name",
    type: "type",
    createdAt: "created_at",
    httpPort: "http_port",
    httpsPort: "https_port",
    serviceId: "service_id",
    updatedAt: "updated_at",
}))
    .pipe(T.ResponsePath("result"));
export const createDirectoryService = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateDirectoryServiceRequest,
    output: CreateDirectoryServiceResponse,
    errors: [VpcServiceNameAlreadyExists, VpcTunnelNotFound],
}));
export const UpdateDirectoryServiceRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    serviceId: Schema.String.pipe(T.HttpPath("serviceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    host: Schema.Union([
        Schema.Struct({
            ipv4: Schema.String,
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv4: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            hostname: Schema.String,
            resolverNetwork: Schema.Struct({
                tunnelId: Schema.String,
                resolverIps: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                tunnelId: "tunnel_id",
                resolverIps: "resolver_ips",
            })),
        }).pipe(Schema.encodeKeys({
            hostname: "hostname",
            resolverNetwork: "resolver_network",
        })),
    ]),
    name: Schema.String,
    type: Schema.Literal("http"),
    httpPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    httpsPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(Schema.encodeKeys({
    host: "host",
    name: "name",
    type: "type",
    httpPort: "http_port",
    httpsPort: "https_port",
}), T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/connectivity/directory/services/{serviceId}",
}));
export const UpdateDirectoryServiceResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    host: Schema.Union([
        Schema.Struct({
            ipv4: Schema.String,
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv4: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            ipv6: Schema.String,
            network: Schema.Struct({
                tunnelId: Schema.String,
            }).pipe(Schema.encodeKeys({ tunnelId: "tunnel_id" })),
        }),
        Schema.Struct({
            hostname: Schema.String,
            resolverNetwork: Schema.Struct({
                tunnelId: Schema.String,
                resolverIps: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                tunnelId: "tunnel_id",
                resolverIps: "resolver_ips",
            })),
        }).pipe(Schema.encodeKeys({
            hostname: "hostname",
            resolverNetwork: "resolver_network",
        })),
    ]),
    name: Schema.String,
    type: Schema.Literal("http"),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    httpPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    httpsPort: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    serviceId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    updatedAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    host: "host",
    name: "name",
    type: "type",
    createdAt: "created_at",
    httpPort: "http_port",
    httpsPort: "https_port",
    serviceId: "service_id",
    updatedAt: "updated_at",
}))
    .pipe(T.ResponsePath("result"));
export const updateDirectoryService = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateDirectoryServiceRequest,
    output: UpdateDirectoryServiceResponse,
    errors: [VpcServiceNotFound, VpcServiceNameAlreadyExists, VpcTunnelNotFound],
}));
export const DeleteDirectoryServiceRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    serviceId: Schema.String.pipe(T.HttpPath("serviceId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/connectivity/directory/services/{serviceId}",
}));
export const DeleteDirectoryServiceResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Unknown;
export const deleteDirectoryService = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteDirectoryServiceRequest,
    output: DeleteDirectoryServiceResponse,
    errors: [VpcServiceNotFound],
}));
//# sourceMappingURL=connectivity.js.map