/**
 * Cloudflare ACM API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service acm
 */
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 AdvancedCertificateManagerRequired extends Schema.TaggedErrorClass()("AdvancedCertificateManagerRequired", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(AdvancedCertificateManagerRequired, [{ code: 1450 }]);
export class InvalidObjectIdentifier extends Schema.TaggedErrorClass()("InvalidObjectIdentifier", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidObjectIdentifier, [{ code: 7003 }]);
export const GetCustomTrustStoreRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    customOriginTrustStoreId: Schema.String.pipe(T.HttpPath("customOriginTrustStoreId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/zones/{zone_id}/acm/custom_trust_store/{customOriginTrustStoreId}",
}));
export const GetCustomTrustStoreResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    certificate: Schema.String,
    expiresOn: Schema.String,
    issuer: Schema.String,
    signature: Schema.String,
    status: Schema.Union([
        Schema.Literals([
            "initializing",
            "pending_deployment",
            "active",
            "pending_deletion",
            "deleted",
            "expired",
        ]),
        Schema.String,
    ]),
    updatedAt: Schema.String,
    uploadedOn: Schema.String,
})
    .pipe(Schema.encodeKeys({
    id: "id",
    certificate: "certificate",
    expiresOn: "expires_on",
    issuer: "issuer",
    signature: "signature",
    status: "status",
    updatedAt: "updated_at",
    uploadedOn: "uploaded_on",
}))
    .pipe(T.ResponsePath("result"));
export const getCustomTrustStore = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetCustomTrustStoreRequest,
    output: GetCustomTrustStoreResponse,
    errors: [],
}));
export const ListCustomTrustStoresRequest = 
/*@__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")),
    limit: Schema.optional(Schema.Number).pipe(T.HttpQuery("limit")),
    offset: Schema.optional(Schema.Number).pipe(T.HttpQuery("offset")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/acm/custom_trust_store" }));
export const ListCustomTrustStoresResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        certificate: Schema.String,
        expiresOn: Schema.String,
        issuer: Schema.String,
        signature: Schema.String,
        status: Schema.Union([
            Schema.Literals([
                "initializing",
                "pending_deployment",
                "active",
                "pending_deletion",
                "deleted",
                "expired",
            ]),
            Schema.String,
        ]),
        updatedAt: Schema.String,
        uploadedOn: Schema.String,
    }).pipe(Schema.encodeKeys({
        id: "id",
        certificate: "certificate",
        expiresOn: "expires_on",
        issuer: "issuer",
        signature: "signature",
        status: "status",
        updatedAt: "updated_at",
        uploadedOn: "uploaded_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 listCustomTrustStores = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListCustomTrustStoresRequest,
    output: ListCustomTrustStoresResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateCustomTrustStoreRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    certificate: Schema.String,
}).pipe(T.Http({ method: "POST", path: "/zones/{zone_id}/acm/custom_trust_store" }));
export const CreateCustomTrustStoreResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    certificate: Schema.String,
    expiresOn: Schema.String,
    issuer: Schema.String,
    signature: Schema.String,
    status: Schema.Union([
        Schema.Literals([
            "initializing",
            "pending_deployment",
            "active",
            "pending_deletion",
            "deleted",
            "expired",
        ]),
        Schema.String,
    ]),
    updatedAt: Schema.String,
    uploadedOn: Schema.String,
})
    .pipe(Schema.encodeKeys({
    id: "id",
    certificate: "certificate",
    expiresOn: "expires_on",
    issuer: "issuer",
    signature: "signature",
    status: "status",
    updatedAt: "updated_at",
    uploadedOn: "uploaded_on",
}))
    .pipe(T.ResponsePath("result"));
export const createCustomTrustStore = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateCustomTrustStoreRequest,
    output: CreateCustomTrustStoreResponse,
    errors: [],
}));
export const DeleteCustomTrustStoreRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    customOriginTrustStoreId: Schema.String.pipe(T.HttpPath("customOriginTrustStoreId")),
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/zones/{zone_id}/acm/custom_trust_store/{customOriginTrustStoreId}",
}));
export const DeleteCustomTrustStoreResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteCustomTrustStore = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteCustomTrustStoreRequest,
    output: DeleteCustomTrustStoreResponse,
    errors: [],
}));
export const GetTotalTlRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
}).pipe(T.Http({ method: "GET", path: "/zones/{zone_id}/acm/total_tls" }));
export const GetTotalTlResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    certificateAuthority: Schema.optional(Schema.Union([
        Schema.Union([
            Schema.Literals(["google", "lets_encrypt", "ssl_com"]),
            Schema.String,
        ]),
        Schema.Null,
    ])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    validityPeriod: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    certificateAuthority: "certificate_authority",
    enabled: "enabled",
    validityPeriod: "validity_period",
}))
    .pipe(T.ResponsePath("result"));
export const getTotalTl = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetTotalTlRequest,
    output: GetTotalTlResponse,
    errors: [InvalidObjectIdentifier, AdvancedCertificateManagerRequired],
}));
export const UpdateTotalTlRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    enabled: Schema.Boolean,
    certificateAuthority: Schema.optional(Schema.Union([
        Schema.Literals(["google", "lets_encrypt", "ssl_com"]),
        Schema.String,
    ])),
}).pipe(Schema.encodeKeys({
    enabled: "enabled",
    certificateAuthority: "certificate_authority",
}), T.Http({ method: "POST", path: "/zones/{zone_id}/acm/total_tls" }));
export const UpdateTotalTlResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    certificateAuthority: Schema.optional(Schema.Union([
        Schema.Union([
            Schema.Literals(["google", "lets_encrypt", "ssl_com"]),
            Schema.String,
        ]),
        Schema.Null,
    ])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    validityPeriod: Schema.optional(Schema.Union([Schema.Literal("90"), Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    certificateAuthority: "certificate_authority",
    enabled: "enabled",
    validityPeriod: "validity_period",
}))
    .pipe(T.ResponsePath("result"));
export const updateTotalTl = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateTotalTlRequest,
    output: UpdateTotalTlResponse,
    errors: [],
}));
export const EditTotalTlRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    zoneId: Schema.String.pipe(T.HttpPath("zone_id")),
    enabled: Schema.Boolean,
    certificateAuthority: Schema.optional(Schema.Union([
        Schema.Literals(["google", "lets_encrypt", "ssl_com"]),
        Schema.String,
    ])),
}).pipe(Schema.encodeKeys({
    enabled: "enabled",
    certificateAuthority: "certificate_authority",
}), T.Http({ method: "POST", path: "/zones/{zone_id}/acm/total_tls" }));
export const EditTotalTlResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    certificateAuthority: Schema.optional(Schema.Union([
        Schema.Union([
            Schema.Literals(["google", "lets_encrypt", "ssl_com"]),
            Schema.String,
        ]),
        Schema.Null,
    ])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    validityPeriod: Schema.optional(Schema.Union([Schema.Literal("90"), Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    certificateAuthority: "certificate_authority",
    enabled: "enabled",
    validityPeriod: "validity_period",
}))
    .pipe(T.ResponsePath("result"));
export const editTotalTl = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: EditTotalTlRequest,
    output: EditTotalTlResponse,
    errors: [],
}));
//# sourceMappingURL=acm.js.map