/**
 * Cloudflare TURNSTILE API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service turnstile
 */
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 RotateSecretWidgetRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    sitekey: Schema.String.pipe(T.HttpPath("sitekey")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    invalidateImmediately: Schema.optional(Schema.Boolean),
}).pipe(Schema.encodeKeys({ invalidateImmediately: "invalidate_immediately" }), T.Http({
    method: "POST",
    path: "/accounts/{account_id}/challenges/widgets/{sitekey}/rotate_secret",
}));
export const RotateSecretWidgetResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    botFightMode: Schema.Boolean,
    clearanceLevel: Schema.Literals([
        "no_clearance",
        "jschallenge",
        "managed",
        "interactive",
    ]),
    createdOn: Schema.String,
    domains: Schema.Array(Schema.String),
    ephemeralId: Schema.Boolean,
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    modifiedOn: Schema.String,
    name: Schema.String,
    offlabel: Schema.Boolean,
    region: Schema.Literals(["world", "china"]),
    secret: Schema.String,
    sitekey: Schema.String,
})
    .pipe(Schema.encodeKeys({
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    createdOn: "created_on",
    domains: "domains",
    ephemeralId: "ephemeral_id",
    mode: "mode",
    modifiedOn: "modified_on",
    name: "name",
    offlabel: "offlabel",
    region: "region",
    secret: "secret",
    sitekey: "sitekey",
}))
    .pipe(T.ResponsePath("result"));
export const rotateSecretWidget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: RotateSecretWidgetRequest,
    output: RotateSecretWidgetResponse,
    errors: [],
}));
export const GetWidgetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    sitekey: Schema.String.pipe(T.HttpPath("sitekey")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/challenges/widgets/{sitekey}",
}));
export const GetWidgetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    botFightMode: Schema.Boolean,
    clearanceLevel: Schema.Literals([
        "no_clearance",
        "jschallenge",
        "managed",
        "interactive",
    ]),
    createdOn: Schema.String,
    domains: Schema.Array(Schema.String),
    ephemeralId: Schema.Boolean,
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    modifiedOn: Schema.String,
    name: Schema.String,
    offlabel: Schema.Boolean,
    region: Schema.Literals(["world", "china"]),
    secret: Schema.String,
    sitekey: Schema.String,
})
    .pipe(Schema.encodeKeys({
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    createdOn: "created_on",
    domains: "domains",
    ephemeralId: "ephemeral_id",
    mode: "mode",
    modifiedOn: "modified_on",
    name: "name",
    offlabel: "offlabel",
    region: "region",
    secret: "secret",
    sitekey: "sitekey",
}))
    .pipe(T.ResponsePath("result"));
export const getWidget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetWidgetRequest,
    output: GetWidgetResponse,
    errors: [],
}));
export const ListWidgetsRequest = /*@__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")),
    direction: Schema.optional(Schema.Literals(["asc", "desc"])).pipe(T.HttpQuery("direction")),
    order: Schema.optional(Schema.Literals(["id", "sitekey", "name", "created_on", "modified_on"])).pipe(T.HttpQuery("order")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/challenges/widgets" }));
export const ListWidgetsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        botFightMode: Schema.Boolean,
        clearanceLevel: Schema.Literals([
            "no_clearance",
            "jschallenge",
            "managed",
            "interactive",
        ]),
        createdOn: Schema.String,
        domains: Schema.Array(Schema.String),
        ephemeralId: Schema.Boolean,
        mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
        modifiedOn: Schema.String,
        name: Schema.String,
        offlabel: Schema.Boolean,
        region: Schema.Literals(["world", "china"]),
        sitekey: Schema.String,
    }).pipe(Schema.encodeKeys({
        botFightMode: "bot_fight_mode",
        clearanceLevel: "clearance_level",
        createdOn: "created_on",
        domains: "domains",
        ephemeralId: "ephemeral_id",
        mode: "mode",
        modifiedOn: "modified_on",
        name: "name",
        offlabel: "offlabel",
        region: "region",
        sitekey: "sitekey",
    }))),
    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 listWidgets = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListWidgetsRequest,
    output: ListWidgetsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateWidgetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    direction: Schema.optional(Schema.Literals(["asc", "desc"])).pipe(T.HttpQuery("direction")),
    order: Schema.optional(Schema.Literals(["id", "sitekey", "name", "created_on", "modified_on"])).pipe(T.HttpQuery("order")),
    page: Schema.optional(Schema.Number).pipe(T.HttpQuery("page")),
    perPage: Schema.optional(Schema.Number).pipe(T.HttpQuery("per_page")),
    domains: Schema.Array(Schema.String),
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    name: Schema.String,
    botFightMode: Schema.optional(Schema.Boolean),
    clearanceLevel: Schema.optional(Schema.Literals(["no_clearance", "jschallenge", "managed", "interactive"])),
    ephemeralId: Schema.optional(Schema.Boolean),
    offlabel: Schema.optional(Schema.Boolean),
    region: Schema.optional(Schema.Literals(["world", "china"])),
}).pipe(Schema.encodeKeys({
    domains: "domains",
    mode: "mode",
    name: "name",
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    ephemeralId: "ephemeral_id",
    offlabel: "offlabel",
    region: "region",
}), T.Http({ method: "POST", path: "/accounts/{account_id}/challenges/widgets" }));
export const CreateWidgetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    botFightMode: Schema.Boolean,
    clearanceLevel: Schema.Literals([
        "no_clearance",
        "jschallenge",
        "managed",
        "interactive",
    ]),
    createdOn: Schema.String,
    domains: Schema.Array(Schema.String),
    ephemeralId: Schema.Boolean,
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    modifiedOn: Schema.String,
    name: Schema.String,
    offlabel: Schema.Boolean,
    region: Schema.Literals(["world", "china"]),
    secret: Schema.String,
    sitekey: Schema.String,
})
    .pipe(Schema.encodeKeys({
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    createdOn: "created_on",
    domains: "domains",
    ephemeralId: "ephemeral_id",
    mode: "mode",
    modifiedOn: "modified_on",
    name: "name",
    offlabel: "offlabel",
    region: "region",
    secret: "secret",
    sitekey: "sitekey",
}))
    .pipe(T.ResponsePath("result"));
export const createWidget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateWidgetRequest,
    output: CreateWidgetResponse,
    errors: [],
}));
export const UpdateWidgetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    sitekey: Schema.String.pipe(T.HttpPath("sitekey")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    domains: Schema.Array(Schema.String),
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    name: Schema.String,
    botFightMode: Schema.optional(Schema.Boolean),
    clearanceLevel: Schema.optional(Schema.Literals(["no_clearance", "jschallenge", "managed", "interactive"])),
    ephemeralId: Schema.optional(Schema.Boolean),
    offlabel: Schema.optional(Schema.Boolean),
    region: Schema.optional(Schema.Literals(["world", "china"])),
}).pipe(Schema.encodeKeys({
    domains: "domains",
    mode: "mode",
    name: "name",
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    ephemeralId: "ephemeral_id",
    offlabel: "offlabel",
    region: "region",
}), T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/challenges/widgets/{sitekey}",
}));
export const UpdateWidgetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    botFightMode: Schema.Boolean,
    clearanceLevel: Schema.Literals([
        "no_clearance",
        "jschallenge",
        "managed",
        "interactive",
    ]),
    createdOn: Schema.String,
    domains: Schema.Array(Schema.String),
    ephemeralId: Schema.Boolean,
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    modifiedOn: Schema.String,
    name: Schema.String,
    offlabel: Schema.Boolean,
    region: Schema.Literals(["world", "china"]),
    secret: Schema.String,
    sitekey: Schema.String,
})
    .pipe(Schema.encodeKeys({
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    createdOn: "created_on",
    domains: "domains",
    ephemeralId: "ephemeral_id",
    mode: "mode",
    modifiedOn: "modified_on",
    name: "name",
    offlabel: "offlabel",
    region: "region",
    secret: "secret",
    sitekey: "sitekey",
}))
    .pipe(T.ResponsePath("result"));
export const updateWidget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateWidgetRequest,
    output: UpdateWidgetResponse,
    errors: [],
}));
export const DeleteWidgetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    sitekey: Schema.String.pipe(T.HttpPath("sitekey")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/challenges/widgets/{sitekey}",
}));
export const DeleteWidgetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    botFightMode: Schema.Boolean,
    clearanceLevel: Schema.Literals([
        "no_clearance",
        "jschallenge",
        "managed",
        "interactive",
    ]),
    createdOn: Schema.String,
    domains: Schema.Array(Schema.String),
    ephemeralId: Schema.Boolean,
    mode: Schema.Literals(["non-interactive", "invisible", "managed"]),
    modifiedOn: Schema.String,
    name: Schema.String,
    offlabel: Schema.Boolean,
    region: Schema.Literals(["world", "china"]),
    secret: Schema.String,
    sitekey: Schema.String,
})
    .pipe(Schema.encodeKeys({
    botFightMode: "bot_fight_mode",
    clearanceLevel: "clearance_level",
    createdOn: "created_on",
    domains: "domains",
    ephemeralId: "ephemeral_id",
    mode: "mode",
    modifiedOn: "modified_on",
    name: "name",
    offlabel: "offlabel",
    region: "region",
    secret: "secret",
    sitekey: "sitekey",
}))
    .pipe(T.ResponsePath("result"));
export const deleteWidget = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteWidgetRequest,
    output: DeleteWidgetResponse,
    errors: [],
}));
//# sourceMappingURL=turnstile.js.map