/**
 * Cloudflare RATE-LIMITS API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service rate-limits
 */
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 GetRateLimitRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    rateLimitId: Schema.String.pipe(T.HttpPath("rateLimitId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/rate_limits/{rateLimitId}" }));
export const GetRateLimitResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    action: Schema.optional(Schema.Union([
        Schema.Struct({
            mode: Schema.optional(Schema.Union([
                Schema.Literals([
                    "simulate",
                    "ban",
                    "challenge",
                    "js_challenge",
                    "managed_challenge",
                ]),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    body: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    contentType: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }).pipe(Schema.encodeKeys({ body: "body", contentType: "content_type" })),
                Schema.Null,
            ])),
            timeout: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }),
        Schema.Null,
    ])),
    bypass: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            name: Schema.optional(Schema.Union([Schema.Literal("url"), Schema.Null])),
            value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        })),
        Schema.Null,
    ])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    disabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    match: Schema.optional(Schema.Union([
        Schema.Struct({
            headers: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    op: Schema.optional(Schema.Union([Schema.Literals(["eq", "ne"]), Schema.Null])),
                    value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
            request: Schema.optional(Schema.Union([
                Schema.Struct({
                    methods: Schema.optional(Schema.Union([
                        Schema.Array(Schema.Literals([
                            "GET",
                            "POST",
                            "PUT",
                            "DELETE",
                            "PATCH",
                            "HEAD",
                            "_ALL_",
                        ])),
                        Schema.Null,
                    ])),
                    schemes: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    originTraffic: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" })),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
    period: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    threshold: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const getRateLimit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetRateLimitRequest,
    output: GetRateLimitResponse,
    errors: [],
}));
export const ListRateLimitsRequest = /*@__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}/rate_limits" }));
export const ListRateLimitsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        action: Schema.optional(Schema.Union([
            Schema.Struct({
                mode: Schema.optional(Schema.Union([
                    Schema.Literals([
                        "simulate",
                        "ban",
                        "challenge",
                        "js_challenge",
                        "managed_challenge",
                    ]),
                    Schema.Null,
                ])),
                response: Schema.optional(Schema.Union([
                    Schema.Struct({
                        body: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        contentType: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    }).pipe(Schema.encodeKeys({
                        body: "body",
                        contentType: "content_type",
                    })),
                    Schema.Null,
                ])),
                timeout: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
            }),
            Schema.Null,
        ])),
        bypass: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                name: Schema.optional(Schema.Union([Schema.Literal("url"), Schema.Null])),
                value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            })),
            Schema.Null,
        ])),
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        disabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        match: Schema.optional(Schema.Union([
            Schema.Struct({
                headers: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        op: Schema.optional(Schema.Union([
                            Schema.Literals(["eq", "ne"]),
                            Schema.Null,
                        ])),
                        value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    })),
                    Schema.Null,
                ])),
                request: Schema.optional(Schema.Union([
                    Schema.Struct({
                        methods: Schema.optional(Schema.Union([
                            Schema.Array(Schema.Literals([
                                "GET",
                                "POST",
                                "PUT",
                                "DELETE",
                                "PATCH",
                                "HEAD",
                                "_ALL_",
                            ])),
                            Schema.Null,
                        ])),
                        schemes: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                        url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                response: Schema.optional(Schema.Union([
                    Schema.Struct({
                        originTraffic: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" })),
                    Schema.Null,
                ])),
            }),
            Schema.Null,
        ])),
        period: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        threshold: Schema.optional(Schema.Union([Schema.Number, 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({ result: "result", resultInfo: "result_info" }));
export const listRateLimits = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListRateLimitsRequest,
    output: ListRateLimitsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateRateLimitRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    action: Schema.Struct({
        mode: Schema.optional(Schema.Literals([
            "simulate",
            "ban",
            "challenge",
            "js_challenge",
            "managed_challenge",
        ])),
        response: Schema.optional(Schema.Struct({
            body: Schema.optional(Schema.String),
            contentType: Schema.optional(Schema.String),
        }).pipe(Schema.encodeKeys({ body: "body", contentType: "content_type" }))),
        timeout: Schema.optional(Schema.Number),
    }),
    match: Schema.Struct({
        headers: Schema.optional(Schema.Array(Schema.Struct({
            name: Schema.optional(Schema.String),
            op: Schema.optional(Schema.Literals(["eq", "ne"])),
            value: Schema.optional(Schema.String),
        }))),
        request: Schema.optional(Schema.Struct({
            methods: Schema.optional(Schema.Array(Schema.Literals([
                "GET",
                "POST",
                "PUT",
                "DELETE",
                "PATCH",
                "HEAD",
                "_ALL_",
            ]))),
            schemes: Schema.optional(Schema.Array(Schema.String)),
            url: Schema.optional(Schema.String),
        })),
        response: Schema.optional(Schema.Struct({
            originTraffic: Schema.optional(Schema.Boolean),
        }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" }))),
    }),
    period: Schema.Number,
    threshold: Schema.Number,
}).pipe(T.Http({ method: "POST", path: "/zones/{zone_id}/rate_limits" }));
export const CreateRateLimitResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    action: Schema.optional(Schema.Union([
        Schema.Struct({
            mode: Schema.optional(Schema.Union([
                Schema.Literals([
                    "simulate",
                    "ban",
                    "challenge",
                    "js_challenge",
                    "managed_challenge",
                ]),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    body: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    contentType: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }).pipe(Schema.encodeKeys({
                    body: "body",
                    contentType: "content_type",
                })),
                Schema.Null,
            ])),
            timeout: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }),
        Schema.Null,
    ])),
    bypass: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            name: Schema.optional(Schema.Union([Schema.Literal("url"), Schema.Null])),
            value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        })),
        Schema.Null,
    ])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    disabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    match: Schema.optional(Schema.Union([
        Schema.Struct({
            headers: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    op: Schema.optional(Schema.Union([Schema.Literals(["eq", "ne"]), Schema.Null])),
                    value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
            request: Schema.optional(Schema.Union([
                Schema.Struct({
                    methods: Schema.optional(Schema.Union([
                        Schema.Array(Schema.Literals([
                            "GET",
                            "POST",
                            "PUT",
                            "DELETE",
                            "PATCH",
                            "HEAD",
                            "_ALL_",
                        ])),
                        Schema.Null,
                    ])),
                    schemes: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    originTraffic: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" })),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
    period: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    threshold: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const createRateLimit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateRateLimitRequest,
    output: CreateRateLimitResponse,
    errors: [],
}));
export const DeleteRateLimitRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    rateLimitId: Schema.String.pipe(T.HttpPath("rateLimitId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/zones/{zone_id}/rate_limits/{rateLimitId}",
}));
export const DeleteRateLimitResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    action: Schema.optional(Schema.Union([
        Schema.Struct({
            mode: Schema.optional(Schema.Union([
                Schema.Literals([
                    "simulate",
                    "ban",
                    "challenge",
                    "js_challenge",
                    "managed_challenge",
                ]),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    body: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    contentType: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }).pipe(Schema.encodeKeys({
                    body: "body",
                    contentType: "content_type",
                })),
                Schema.Null,
            ])),
            timeout: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }),
        Schema.Null,
    ])),
    bypass: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            name: Schema.optional(Schema.Union([Schema.Literal("url"), Schema.Null])),
            value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        })),
        Schema.Null,
    ])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    disabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    match: Schema.optional(Schema.Union([
        Schema.Struct({
            headers: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    op: Schema.optional(Schema.Union([Schema.Literals(["eq", "ne"]), Schema.Null])),
                    value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
            request: Schema.optional(Schema.Union([
                Schema.Struct({
                    methods: Schema.optional(Schema.Union([
                        Schema.Array(Schema.Literals([
                            "GET",
                            "POST",
                            "PUT",
                            "DELETE",
                            "PATCH",
                            "HEAD",
                            "_ALL_",
                        ])),
                        Schema.Null,
                    ])),
                    schemes: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    originTraffic: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" })),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
    period: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    threshold: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteRateLimit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteRateLimitRequest,
    output: DeleteRateLimitResponse,
    errors: [],
}));
export const EditRateLimitRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    rateLimitId: Schema.String.pipe(T.HttpPath("rateLimitId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    action: Schema.Struct({
        mode: Schema.optional(Schema.Literals([
            "simulate",
            "ban",
            "challenge",
            "js_challenge",
            "managed_challenge",
        ])),
        response: Schema.optional(Schema.Struct({
            body: Schema.optional(Schema.String),
            contentType: Schema.optional(Schema.String),
        }).pipe(Schema.encodeKeys({ body: "body", contentType: "content_type" }))),
        timeout: Schema.optional(Schema.Number),
    }),
    match: Schema.Struct({
        headers: Schema.optional(Schema.Array(Schema.Struct({
            name: Schema.optional(Schema.String),
            op: Schema.optional(Schema.Literals(["eq", "ne"])),
            value: Schema.optional(Schema.String),
        }))),
        request: Schema.optional(Schema.Struct({
            methods: Schema.optional(Schema.Array(Schema.Literals([
                "GET",
                "POST",
                "PUT",
                "DELETE",
                "PATCH",
                "HEAD",
                "_ALL_",
            ]))),
            schemes: Schema.optional(Schema.Array(Schema.String)),
            url: Schema.optional(Schema.String),
        })),
        response: Schema.optional(Schema.Struct({
            originTraffic: Schema.optional(Schema.Boolean),
        }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" }))),
    }),
    period: Schema.Number,
    threshold: Schema.Number,
}).pipe(T.Http({ method: "PUT", path: "/zones/{zone_id}/rate_limits/{rateLimitId}" }));
export const EditRateLimitResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    action: Schema.optional(Schema.Union([
        Schema.Struct({
            mode: Schema.optional(Schema.Union([
                Schema.Literals([
                    "simulate",
                    "ban",
                    "challenge",
                    "js_challenge",
                    "managed_challenge",
                ]),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    body: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    contentType: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }).pipe(Schema.encodeKeys({ body: "body", contentType: "content_type" })),
                Schema.Null,
            ])),
            timeout: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        }),
        Schema.Null,
    ])),
    bypass: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            name: Schema.optional(Schema.Union([Schema.Literal("url"), Schema.Null])),
            value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        })),
        Schema.Null,
    ])),
    description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    disabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    match: Schema.optional(Schema.Union([
        Schema.Struct({
            headers: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    op: Schema.optional(Schema.Union([Schema.Literals(["eq", "ne"]), Schema.Null])),
                    value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                Schema.Null,
            ])),
            request: Schema.optional(Schema.Union([
                Schema.Struct({
                    methods: Schema.optional(Schema.Union([
                        Schema.Array(Schema.Literals([
                            "GET",
                            "POST",
                            "PUT",
                            "DELETE",
                            "PATCH",
                            "HEAD",
                            "_ALL_",
                        ])),
                        Schema.Null,
                    ])),
                    schemes: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    url: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }),
                Schema.Null,
            ])),
            response: Schema.optional(Schema.Union([
                Schema.Struct({
                    originTraffic: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }).pipe(Schema.encodeKeys({ originTraffic: "origin_traffic" })),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
    period: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    threshold: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const editRateLimit = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: EditRateLimitRequest,
    output: EditRateLimitResponse,
    errors: [],
}));
//# sourceMappingURL=rate-limits.js.map