/**
 * Cloudflare SNIPPETS API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service snippets
 */
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 GetContentRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    snippetName: Schema.String.pipe(T.HttpPath("snippetName")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/zones/{zone_id}/snippets/{snippetName}/content",
}));
export const GetContentResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Unknown;
export const getContent = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetContentRequest,
    output: GetContentResponse,
    errors: [],
}));
export const ListRulesRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/snippets/snippet_rules" }));
export const ListRulesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        expression: Schema.String,
        lastUpdated: Schema.String,
        snippetName: Schema.String,
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        expression: "expression",
        lastUpdated: "last_updated",
        snippetName: "snippet_name",
        description: "description",
        enabled: "enabled",
    }))),
});
export const listRules = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListRulesRequest,
    output: ListRulesResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const PutRuleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    rules: Schema.Array(Schema.Struct({
        expression: Schema.String,
        snippetName: Schema.String,
        description: Schema.optional(Schema.String),
        enabled: Schema.optional(Schema.Boolean),
    }).pipe(Schema.encodeKeys({
        expression: "expression",
        snippetName: "snippet_name",
        description: "description",
        enabled: "enabled",
    }))),
}).pipe(T.Http({ method: "PUT", path: "/zones/{zone_id}/snippets/snippet_rules" }));
export const PutRuleResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        expression: Schema.String,
        lastUpdated: Schema.String,
        snippetName: Schema.String,
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        expression: "expression",
        lastUpdated: "last_updated",
        snippetName: "snippet_name",
        description: "description",
        enabled: "enabled",
    }))),
});
export const putRule = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: PutRuleRequest,
    output: PutRuleResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const DeleteRuleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({ method: "DELETE", path: "/zones/{zone_id}/snippets/snippet_rules" }));
export const DeleteRuleResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        expression: Schema.String,
        lastUpdated: Schema.String,
        snippetName: Schema.String,
        description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        expression: "expression",
        lastUpdated: "last_updated",
        snippetName: "snippet_name",
        description: "description",
        enabled: "enabled",
    }))),
});
export const deleteRule = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: DeleteRuleRequest,
    output: DeleteRuleResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const GetSnippetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    snippetName: Schema.String.pipe(T.HttpPath("snippetName")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/snippets/{snippetName}" }));
export const GetSnippetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    createdOn: Schema.String,
    snippetName: Schema.String,
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    createdOn: "created_on",
    snippetName: "snippet_name",
    modifiedOn: "modified_on",
}))
    .pipe(T.ResponsePath("result"));
export const getSnippet = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetSnippetRequest,
    output: GetSnippetResponse,
    errors: [],
}));
export const ListSnippetsRequest = /*@__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}/snippets" }));
export const ListSnippetsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        createdOn: Schema.String,
        snippetName: Schema.String,
        modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        createdOn: "created_on",
        snippetName: "snippet_name",
        modifiedOn: "modified_on",
    }))),
    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 listSnippets = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListSnippetsRequest,
    output: ListSnippetsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const PutSnippetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    snippetName: Schema.String.pipe(T.HttpPath("snippetName")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    metadata: Schema.Struct({
        mainModule: Schema.String,
    }).pipe(Schema.encodeKeys({ mainModule: "main_module" })),
}).pipe(T.Http({
    method: "PUT",
    path: "/zones/{zone_id}/snippets/{snippetName}",
    contentType: "multipart",
}));
export const PutSnippetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    createdOn: Schema.String,
    snippetName: Schema.String,
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    createdOn: "created_on",
    snippetName: "snippet_name",
    modifiedOn: "modified_on",
}))
    .pipe(T.ResponsePath("result"));
export const putSnippet = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PutSnippetRequest,
    output: PutSnippetResponse,
    errors: [],
}));
export const DeleteSnippetRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    snippetName: Schema.String.pipe(T.HttpPath("snippetName")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({ method: "DELETE", path: "/zones/{zone_id}/snippets/{snippetName}" }));
export const DeleteSnippetResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Union([
    Schema.String,
    Schema.Null,
]).pipe(T.ResponsePath("result"));
export const deleteSnippet = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteSnippetRequest,
    output: DeleteSnippetResponse,
    errors: [],
}));
//# sourceMappingURL=snippets.js.map