/**
 * Cloudflare TOKEN-VALIDATION API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service token-validation
 */
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 GetConfigurationRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    configId: Schema.String.pipe(T.HttpPath("configId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/zones/{zone_id}/token_validation/config/{configId}",
}));
export const GetConfigurationResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    createdAt: Schema.String,
    credentials: Schema.Struct({
        keys: Schema.Array(Schema.Union([
            Schema.Struct({
                alg: Schema.Literal("ES256"),
                crv: Schema.Literal("P-256"),
                kid: Schema.String,
                kty: Schema.Literal("EC"),
                x: Schema.String,
                y: Schema.String,
            }),
            Schema.Struct({
                alg: Schema.Literal("ES384"),
                crv: Schema.Literal("P-384"),
                kid: Schema.String,
                kty: Schema.Literal("EC"),
                x: Schema.String,
                y: Schema.String,
            }),
            Schema.Struct({
                alg: Schema.Literals([
                    "RS256",
                    "RS384",
                    "RS512",
                    "PS256",
                    "PS384",
                    "PS512",
                ]),
                e: Schema.String,
                kid: Schema.String,
                kty: Schema.Literal("RSA"),
                n: Schema.String,
            }),
        ])),
    }),
    description: Schema.String,
    lastUpdated: Schema.String,
    title: Schema.String,
    tokenSources: Schema.Array(Schema.String),
    tokenType: Schema.Literal("JWT"),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdAt: "created_at",
    credentials: "credentials",
    description: "description",
    lastUpdated: "last_updated",
    title: "title",
    tokenSources: "token_sources",
    tokenType: "token_type",
}))
    .pipe(T.ResponsePath("result"));
export const getConfiguration = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetConfigurationRequest,
    output: GetConfigurationResponse,
    errors: [],
}));
export const ListConfigurationsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/token_validation/config" }));
export const ListConfigurationsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        createdAt: Schema.String,
        credentials: Schema.Struct({
            keys: Schema.Array(Schema.Union([
                Schema.Struct({
                    alg: Schema.Literal("ES256"),
                    crv: Schema.Literal("P-256"),
                    kid: Schema.String,
                    kty: Schema.Literal("EC"),
                    x: Schema.String,
                    y: Schema.String,
                }),
                Schema.Struct({
                    alg: Schema.Literal("ES384"),
                    crv: Schema.Literal("P-384"),
                    kid: Schema.String,
                    kty: Schema.Literal("EC"),
                    x: Schema.String,
                    y: Schema.String,
                }),
                Schema.Struct({
                    alg: Schema.Literals([
                        "RS256",
                        "RS384",
                        "RS512",
                        "PS256",
                        "PS384",
                        "PS512",
                    ]),
                    e: Schema.String,
                    kid: Schema.String,
                    kty: Schema.Literal("RSA"),
                    n: Schema.String,
                }),
            ])),
        }),
        description: Schema.String,
        lastUpdated: Schema.String,
        title: Schema.String,
        tokenSources: Schema.Array(Schema.String),
        tokenType: Schema.Literal("JWT"),
    }).pipe(Schema.encodeKeys({
        id: "id",
        createdAt: "created_at",
        credentials: "credentials",
        description: "description",
        lastUpdated: "last_updated",
        title: "title",
        tokenSources: "token_sources",
        tokenType: "token_type",
    }))),
    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 listConfigurations = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListConfigurationsRequest,
    output: ListConfigurationsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateConfigurationRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    credentials: Schema.Struct({
        keys: Schema.Array(Schema.Union([
            Schema.Struct({
                alg: Schema.Literal("ES256"),
                crv: Schema.Literal("P-256"),
                kid: Schema.String,
                kty: Schema.Literal("EC"),
                x: Schema.String,
                y: Schema.String,
            }),
            Schema.Struct({
                alg: Schema.Literal("ES384"),
                crv: Schema.Literal("P-384"),
                kid: Schema.String,
                kty: Schema.Literal("EC"),
                x: Schema.String,
                y: Schema.String,
            }),
            Schema.Struct({
                alg: Schema.Literals([
                    "RS256",
                    "RS384",
                    "RS512",
                    "PS256",
                    "PS384",
                    "PS512",
                ]),
                e: Schema.String,
                kid: Schema.String,
                kty: Schema.Literal("RSA"),
                n: Schema.String,
            }),
        ])),
    }),
    description: Schema.String,
    title: Schema.String,
    tokenSources: Schema.Array(Schema.String),
    tokenType: Schema.Literal("JWT"),
}).pipe(Schema.encodeKeys({
    credentials: "credentials",
    description: "description",
    title: "title",
    tokenSources: "token_sources",
    tokenType: "token_type",
}), T.Http({
    method: "POST",
    path: "/zones/{zone_id}/token_validation/config",
}));
export const CreateConfigurationResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    createdAt: Schema.String,
    credentials: Schema.Struct({
        keys: Schema.Array(Schema.Union([
            Schema.Struct({
                alg: Schema.Literal("ES256"),
                crv: Schema.Literal("P-256"),
                kid: Schema.String,
                kty: Schema.Literal("EC"),
                x: Schema.String,
                y: Schema.String,
            }),
            Schema.Struct({
                alg: Schema.Literal("ES384"),
                crv: Schema.Literal("P-384"),
                kid: Schema.String,
                kty: Schema.Literal("EC"),
                x: Schema.String,
                y: Schema.String,
            }),
            Schema.Struct({
                alg: Schema.Literals([
                    "RS256",
                    "RS384",
                    "RS512",
                    "PS256",
                    "PS384",
                    "PS512",
                ]),
                e: Schema.String,
                kid: Schema.String,
                kty: Schema.Literal("RSA"),
                n: Schema.String,
            }),
        ])),
    }),
    description: Schema.String,
    lastUpdated: Schema.String,
    title: Schema.String,
    tokenSources: Schema.Array(Schema.String),
    tokenType: Schema.Literal("JWT"),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdAt: "created_at",
    credentials: "credentials",
    description: "description",
    lastUpdated: "last_updated",
    title: "title",
    tokenSources: "token_sources",
    tokenType: "token_type",
}))
    .pipe(T.ResponsePath("result"));
export const createConfiguration = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateConfigurationRequest,
    output: CreateConfigurationResponse,
    errors: [],
}));
export const PatchConfigurationRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    configId: Schema.String.pipe(T.HttpPath("configId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    description: Schema.optional(Schema.String),
    title: Schema.optional(Schema.String),
    tokenSources: Schema.optional(Schema.Array(Schema.String)),
}).pipe(Schema.encodeKeys({
    description: "description",
    title: "title",
    tokenSources: "token_sources",
}), T.Http({
    method: "PATCH",
    path: "/zones/{zone_id}/token_validation/config/{configId}",
}));
export const PatchConfigurationResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    title: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    tokenSources: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    description: "description",
    title: "title",
    tokenSources: "token_sources",
}))
    .pipe(T.ResponsePath("result"));
export const patchConfiguration = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PatchConfigurationRequest,
    output: PatchConfigurationResponse,
    errors: [],
}));
export const DeleteConfigurationRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    configId: Schema.String.pipe(T.HttpPath("configId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/zones/{zone_id}/token_validation/config/{configId}",
}));
export const DeleteConfigurationResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteConfiguration = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteConfigurationRequest,
    output: DeleteConfigurationResponse,
    errors: [],
}));
export const PutConfigurationCredentialRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    configId: Schema.String.pipe(T.HttpPath("configId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    keys: Schema.Array(Schema.Union([
        Schema.Struct({
            alg: Schema.Literal("ES256"),
            crv: Schema.Literal("P-256"),
            kid: Schema.String,
            kty: Schema.Literal("EC"),
            x: Schema.String,
            y: Schema.String,
        }),
        Schema.Struct({
            alg: Schema.Literal("ES384"),
            crv: Schema.Literal("P-384"),
            kid: Schema.String,
            kty: Schema.Literal("EC"),
            x: Schema.String,
            y: Schema.String,
        }),
        Schema.Struct({
            alg: Schema.Literals([
                "RS256",
                "RS384",
                "RS512",
                "PS256",
                "PS384",
                "PS512",
            ]),
            e: Schema.String,
            kid: Schema.String,
            kty: Schema.Literal("RSA"),
            n: Schema.String,
        }),
    ])),
}).pipe(T.Http({
    method: "PUT",
    path: "/zones/{zone_id}/token_validation/config/{configId}/credentials",
}));
export const PutConfigurationCredentialResponse = 
/*@__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",
    }))),
    keys: Schema.Array(Schema.Union([
        Schema.Struct({
            alg: Schema.Literal("ES256"),
            crv: Schema.Literal("P-256"),
            kid: Schema.String,
            kty: Schema.Literal("EC"),
            x: Schema.String,
            y: Schema.String,
        }),
        Schema.Struct({
            alg: Schema.Literal("ES384"),
            crv: Schema.Literal("P-384"),
            kid: Schema.String,
            kty: Schema.Literal("EC"),
            x: Schema.String,
            y: Schema.String,
        }),
        Schema.Struct({
            alg: Schema.Literals([
                "RS256",
                "RS384",
                "RS512",
                "PS256",
                "PS384",
                "PS512",
            ]),
            e: Schema.String,
            kid: Schema.String,
            kty: Schema.Literal("RSA"),
            n: Schema.String,
        }),
    ])),
    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 putConfigurationCredential = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PutConfigurationCredentialRequest,
    output: PutConfigurationCredentialResponse,
    errors: [],
}));
export const GetRuleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ruleId: Schema.String.pipe(T.HttpPath("ruleId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/zones/{zone_id}/token_validation/rules/{ruleId}",
}));
export const GetRuleResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    action: Schema.Literals(["log", "block"]),
    description: Schema.String,
    enabled: Schema.Boolean,
    expression: Schema.String,
    selector: Schema.Struct({
        exclude: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                operationIds: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
            Schema.Null,
        ])),
        include: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                host: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            })),
            Schema.Null,
        ])),
    }),
    title: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastUpdated: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    action: "action",
    description: "description",
    enabled: "enabled",
    expression: "expression",
    selector: "selector",
    title: "title",
    id: "id",
    createdAt: "created_at",
    lastUpdated: "last_updated",
}))
    .pipe(T.ResponsePath("result"));
export const getRule = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetRuleRequest,
    output: GetRuleResponse,
    errors: [],
}));
export const ListRulesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
    id: Schema.optional(Schema.String).pipe(T.HttpQuery("id")),
    action: Schema.optional(Schema.Literals(["log", "block"])).pipe(T.HttpQuery("action")),
    enabled: Schema.optional(Schema.Boolean).pipe(T.HttpQuery("enabled")),
    host: Schema.optional(Schema.String).pipe(T.HttpQuery("host")),
    hostname: Schema.optional(Schema.String).pipe(T.HttpQuery("hostname")),
    ruleId: Schema.optional(Schema.String).pipe(T.HttpQuery("rule_id")),
    tokenConfiguration: Schema.optional(Schema.Array(Schema.String)).pipe(T.HttpQuery("token_configuration")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/token_validation/rules" }));
export const ListRulesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        action: Schema.Literals(["log", "block"]),
        description: Schema.String,
        enabled: Schema.Boolean,
        expression: Schema.String,
        selector: Schema.Struct({
            exclude: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    operationIds: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
                Schema.Null,
            ])),
            include: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    host: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                })),
                Schema.Null,
            ])),
        }),
        title: Schema.String,
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        lastUpdated: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        action: "action",
        description: "description",
        enabled: "enabled",
        expression: "expression",
        selector: "selector",
        title: "title",
        id: "id",
        createdAt: "created_at",
        lastUpdated: "last_updated",
    }))),
    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 listRules = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListRulesRequest,
    output: ListRulesResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateRuleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    action: Schema.Literals(["log", "block"]),
    description: Schema.String,
    enabled: Schema.Boolean,
    expression: Schema.String,
    selector: Schema.Struct({
        exclude: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                operationIds: Schema.optional(Schema.Array(Schema.String)),
            }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
            Schema.Null,
        ])),
        include: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                host: Schema.optional(Schema.Array(Schema.String)),
            })),
            Schema.Null,
        ])),
    }),
    title: Schema.String,
}).pipe(T.Http({ method: "POST", path: "/zones/{zone_id}/token_validation/rules" }));
export const CreateRuleResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    action: Schema.Literals(["log", "block"]),
    description: Schema.String,
    enabled: Schema.Boolean,
    expression: Schema.String,
    selector: Schema.Struct({
        exclude: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                operationIds: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
            Schema.Null,
        ])),
        include: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                host: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            })),
            Schema.Null,
        ])),
    }),
    title: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastUpdated: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    action: "action",
    description: "description",
    enabled: "enabled",
    expression: "expression",
    selector: "selector",
    title: "title",
    id: "id",
    createdAt: "created_at",
    lastUpdated: "last_updated",
}))
    .pipe(T.ResponsePath("result"));
export const createRule = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateRuleRequest,
    output: CreateRuleResponse,
    errors: [],
}));
export const PatchRuleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ruleId: Schema.String.pipe(T.HttpPath("ruleId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    action: Schema.optional(Schema.Literals(["log", "block"])),
    description: Schema.optional(Schema.String),
    enabled: Schema.optional(Schema.Boolean),
    expression: Schema.optional(Schema.String),
    position: Schema.optional(Schema.Union([
        Schema.Struct({
            index: Schema.Number,
        }),
        Schema.Struct({
            before: Schema.optional(Schema.String),
        }),
        Schema.Struct({
            after: Schema.optional(Schema.String),
        }),
    ])),
    selector: Schema.optional(Schema.Struct({
        exclude: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                operationIds: Schema.optional(Schema.Array(Schema.String)),
            }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
            Schema.Null,
        ])),
        include: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                host: Schema.optional(Schema.Array(Schema.String)),
            })),
            Schema.Null,
        ])),
    })),
    title: Schema.optional(Schema.String),
}).pipe(T.Http({
    method: "PATCH",
    path: "/zones/{zone_id}/token_validation/rules/{ruleId}",
}));
export const PatchRuleResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    action: Schema.Literals(["log", "block"]),
    description: Schema.String,
    enabled: Schema.Boolean,
    expression: Schema.String,
    selector: Schema.Struct({
        exclude: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                operationIds: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
            Schema.Null,
        ])),
        include: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                host: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            })),
            Schema.Null,
        ])),
    }),
    title: Schema.String,
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastUpdated: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    action: "action",
    description: "description",
    enabled: "enabled",
    expression: "expression",
    selector: "selector",
    title: "title",
    id: "id",
    createdAt: "created_at",
    lastUpdated: "last_updated",
}))
    .pipe(T.ResponsePath("result"));
export const patchRule = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PatchRuleRequest,
    output: PatchRuleResponse,
    errors: [],
}));
export const DeleteRuleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ruleId: Schema.String.pipe(T.HttpPath("ruleId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/zones/{zone_id}/token_validation/rules/{ruleId}",
}));
export const DeleteRuleResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Unknown.pipe(T.ResponsePath("result"));
export const deleteRule = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteRuleRequest,
    output: DeleteRuleResponse,
    errors: [],
}));
export const BulkCreateRulesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    body: Schema.Array(Schema.Struct({
        action: Schema.Literals(["log", "block"]),
        description: Schema.String,
        enabled: Schema.Boolean,
        expression: Schema.String,
        selector: Schema.Struct({
            exclude: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    operationIds: Schema.optional(Schema.Array(Schema.String)),
                }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
                Schema.Null,
            ])),
            include: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    host: Schema.optional(Schema.Array(Schema.String)),
                })),
                Schema.Null,
            ])),
        }),
        title: Schema.String,
    })).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "POST",
    path: "/zones/{zone_id}/token_validation/rules/bulk",
}));
export const BulkCreateRulesResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        action: Schema.Literals(["log", "block"]),
        description: Schema.String,
        enabled: Schema.Boolean,
        expression: Schema.String,
        selector: Schema.Struct({
            exclude: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    operationIds: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
                Schema.Null,
            ])),
            include: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    host: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                })),
                Schema.Null,
            ])),
        }),
        title: Schema.String,
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        lastUpdated: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        action: "action",
        description: "description",
        enabled: "enabled",
        expression: "expression",
        selector: "selector",
        title: "title",
        id: "id",
        createdAt: "created_at",
        lastUpdated: "last_updated",
    }))),
});
export const bulkCreateRules = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: BulkCreateRulesRequest,
    output: BulkCreateRulesResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const BulkPatchRulesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    body: Schema.Array(Schema.Struct({
        id: Schema.String,
        action: Schema.optional(Schema.Literals(["log", "block"])),
        description: Schema.optional(Schema.String),
        enabled: Schema.optional(Schema.Boolean),
        expression: Schema.optional(Schema.String),
        position: Schema.optional(Schema.Union([
            Schema.Struct({
                index: Schema.Number,
            }),
            Schema.Struct({
                before: Schema.optional(Schema.String),
            }),
            Schema.Struct({
                after: Schema.optional(Schema.String),
            }),
        ])),
        selector: Schema.optional(Schema.Struct({
            exclude: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    operationIds: Schema.optional(Schema.Array(Schema.String)),
                }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
                Schema.Null,
            ])),
            include: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    host: Schema.optional(Schema.Array(Schema.String)),
                })),
                Schema.Null,
            ])),
        })),
        title: Schema.optional(Schema.String),
    })).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "PATCH",
    path: "/zones/{zone_id}/token_validation/rules/bulk",
}));
export const BulkPatchRulesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        action: Schema.Literals(["log", "block"]),
        description: Schema.String,
        enabled: Schema.Boolean,
        expression: Schema.String,
        selector: Schema.Struct({
            exclude: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    operationIds: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({ operationIds: "operation_ids" }))),
                Schema.Null,
            ])),
            include: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    host: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                })),
                Schema.Null,
            ])),
        }),
        title: Schema.String,
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdAt: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        lastUpdated: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        action: "action",
        description: "description",
        enabled: "enabled",
        expression: "expression",
        selector: "selector",
        title: "title",
        id: "id",
        createdAt: "created_at",
        lastUpdated: "last_updated",
    }))),
});
export const bulkPatchRules = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: BulkPatchRulesRequest,
    output: BulkPatchRulesResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
//# sourceMappingURL=token-validation.js.map