/**
 * Cloudflare SECRETS-STORE API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service secrets-store
 */
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 InvalidAccountId extends Schema.TaggedErrorClass()("InvalidAccountId", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidAccountId, [{ code: 7003 }]);
export class InvalidJsonBody extends Schema.TaggedErrorClass()("InvalidJsonBody", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidJsonBody, [
    { code: 1001, message: { includes: "invalid_json_body" } },
]);
export class MaximumStoresExceeded extends Schema.TaggedErrorClass()("MaximumStoresExceeded", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MaximumStoresExceeded, [
    { code: 1003, message: { includes: "maximum_stores_exceeded" } },
]);
export class NotFound extends Schema.TaggedErrorClass()("NotFound", {
    code: Schema.Number,
    message: Schema.String,
}) {
}
T.applyErrorMatchers(NotFound, [{ code: 1000 }]);
export class SecretNameAlreadyExists extends Schema.TaggedErrorClass()("SecretNameAlreadyExists", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(SecretNameAlreadyExists, [
    { code: 1003, message: { includes: "secret_name_already_exists" } },
]);
export class SecretNameEmpty extends Schema.TaggedErrorClass()("SecretNameEmpty", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(SecretNameEmpty, [
    { code: 1001, message: { includes: "secret_name_empty" } },
]);
export class SecretNotFound extends Schema.TaggedErrorClass()("SecretNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(SecretNotFound, [
    { code: 1001, message: { includes: "secret_not_found" } },
]);
export class SecretScopeInvalid extends Schema.TaggedErrorClass()("SecretScopeInvalid", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(SecretScopeInvalid, [
    { code: 1001, message: { includes: "secret_scope_invalid" } },
]);
export class SecretScopesEmpty extends Schema.TaggedErrorClass()("SecretScopesEmpty", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(SecretScopesEmpty, [
    { code: 1001, message: { includes: "secret_scopes_empty" } },
]);
export class StoreNotFound extends Schema.TaggedErrorClass()("StoreNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(StoreNotFound, [
    { code: 1001, message: { includes: "store_not_found" } },
]);
export const GetQuotaRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/secrets_store/quota" }));
export const GetQuotaResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    secrets: Schema.Struct({
        quota: Schema.Number,
        usage: Schema.Number,
    }),
}).pipe(T.ResponsePath("result"));
export const getQuota = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetQuotaRequest,
    output: GetQuotaResponse,
    errors: [InvalidAccountId],
}));
export const ListStoresRequest = /*@__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(["name", "comment", "created", "modified", "status"])).pipe(T.HttpQuery("order")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/secrets_store/stores",
}));
export const ListStoresResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        created: Schema.String,
        modified: Schema.String,
        name: Schema.String,
    })),
    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 listStores = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListStoresRequest,
    output: ListStoresResponse,
    errors: [InvalidAccountId],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateStoreRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/secrets_store/stores",
}));
export const CreateStoreResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
}).pipe(T.ResponsePath("result"));
export const createStore = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateStoreRequest,
    output: CreateStoreResponse,
    errors: [InvalidAccountId, MaximumStoresExceeded],
}));
export const DeleteStoreRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}",
}));
export const DeleteStoreResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    created: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modified: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteStore = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteStoreRequest,
    output: DeleteStoreResponse,
    errors: [StoreNotFound, InvalidAccountId, NotFound],
}));
export const GetStoreSecretRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    secretId: Schema.String.pipe(T.HttpPath("secretId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets/{secretId}",
}));
export const GetStoreSecretResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    status: Schema.Literals(["pending", "active", "deleted"]),
    storeId: Schema.String,
    comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    modified: "modified",
    name: "name",
    status: "status",
    storeId: "store_id",
    comment: "comment",
}))
    .pipe(T.ResponsePath("result"));
export const getStoreSecret = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetStoreSecretRequest,
    output: GetStoreSecretResponse,
    errors: [StoreNotFound, SecretNotFound, InvalidAccountId, NotFound],
}));
export const ListStoreSecretsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    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(["name", "comment", "created", "modified", "status"])).pipe(T.HttpQuery("order")),
    scopes: Schema.optional(Schema.Array(Schema.Array(Schema.String))).pipe(T.HttpQuery("scopes")),
    search: Schema.optional(Schema.String).pipe(T.HttpQuery("search")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets",
}));
export const ListStoreSecretsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        created: Schema.String,
        modified: Schema.String,
        name: Schema.String,
        status: Schema.Literals(["pending", "active", "deleted"]),
        storeId: Schema.String,
        comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        created: "created",
        modified: "modified",
        name: "name",
        status: "status",
        storeId: "store_id",
        comment: "comment",
    }))),
    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 listStoreSecrets = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListStoreSecretsRequest,
    output: ListStoreSecretsResponse,
    errors: [StoreNotFound, InvalidAccountId],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateStoreSecretRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    body: Schema.Array(Schema.Struct({
        name: Schema.String,
        scopes: Schema.Array(Schema.String),
        value: Schema.String,
        comment: Schema.optional(Schema.String),
    })).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets",
}));
export const CreateStoreSecretResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        created: Schema.String,
        modified: Schema.String,
        name: Schema.String,
        status: Schema.Literals(["pending", "active", "deleted"]),
        storeId: Schema.String,
        comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        created: "created",
        modified: "modified",
        name: "name",
        status: "status",
        storeId: "store_id",
        comment: "comment",
    }))),
});
export const createStoreSecret = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: CreateStoreSecretRequest,
    output: CreateStoreSecretResponse,
    errors: [
        StoreNotFound,
        InvalidAccountId,
        SecretNameEmpty,
        SecretNameAlreadyExists,
        SecretScopeInvalid,
    ],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const PatchStoreSecretRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    secretId: Schema.String.pipe(T.HttpPath("secretId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    comment: Schema.optional(Schema.String),
    scopes: Schema.optional(Schema.Array(Schema.String)),
}).pipe(T.Http({
    method: "PATCH",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets/{secretId}",
}));
export const PatchStoreSecretResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    status: Schema.Literals(["pending", "active", "deleted"]),
    storeId: Schema.String,
    comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    modified: "modified",
    name: "name",
    status: "status",
    storeId: "store_id",
    comment: "comment",
}))
    .pipe(T.ResponsePath("result"));
export const patchStoreSecret = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PatchStoreSecretRequest,
    output: PatchStoreSecretResponse,
    errors: [StoreNotFound, SecretNotFound, InvalidAccountId, SecretScopeInvalid],
}));
export const DeleteStoreSecretRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    secretId: Schema.String.pipe(T.HttpPath("secretId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets/{secretId}",
}));
export const DeleteStoreSecretResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    created: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modified: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    status: Schema.optional(Schema.Union([
        Schema.Literals(["pending", "active", "deleted"]),
        Schema.Null,
    ])),
    storeId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    modified: "modified",
    name: "name",
    status: "status",
    storeId: "store_id",
    comment: "comment",
}))
    .pipe(T.ResponsePath("result"));
export const deleteStoreSecret = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteStoreSecretRequest,
    output: DeleteStoreSecretResponse,
    errors: [StoreNotFound, SecretNotFound, InvalidAccountId, NotFound],
}));
export const BulkDeleteStoreSecretsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets",
}));
export const BulkDeleteStoreSecretsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        created: Schema.String,
        modified: Schema.String,
        name: Schema.String,
        status: Schema.Literals(["pending", "active", "deleted"]),
        storeId: Schema.String,
        comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        created: "created",
        modified: "modified",
        name: "name",
        status: "status",
        storeId: "store_id",
        comment: "comment",
    }))),
});
export const bulkDeleteStoreSecrets = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: BulkDeleteStoreSecretsRequest,
    output: BulkDeleteStoreSecretsResponse,
    errors: [StoreNotFound, InvalidAccountId, InvalidJsonBody],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const DuplicateStoreSecretRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    storeId: Schema.String.pipe(T.HttpPath("storeId")),
    secretId: Schema.String.pipe(T.HttpPath("secretId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    scopes: Schema.Array(Schema.String),
    comment: Schema.optional(Schema.String),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/secrets_store/stores/{storeId}/secrets/{secretId}/duplicate",
}));
export const DuplicateStoreSecretResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    created: Schema.String,
    modified: Schema.String,
    name: Schema.String,
    status: Schema.Literals(["pending", "active", "deleted"]),
    storeId: Schema.String,
    comment: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    created: "created",
    modified: "modified",
    name: "name",
    status: "status",
    storeId: "store_id",
    comment: "comment",
}))
    .pipe(T.ResponsePath("result"));
export const duplicateStoreSecret = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DuplicateStoreSecretRequest,
    output: DuplicateStoreSecretResponse,
    errors: [
        StoreNotFound,
        SecretNotFound,
        SecretNameEmpty,
        SecretScopesEmpty,
        SecretNameAlreadyExists,
        InvalidAccountId,
        SecretScopeInvalid,
    ],
}));
//# sourceMappingURL=secrets-store.js.map