/**
 * Cloudflare ACCOUNTS API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service accounts
 */
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 AccountCreationForbidden extends Schema.TaggedErrorClass()("AccountCreationForbidden", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(AccountCreationForbidden, [{ code: 1002 }]);
export class AccountNameTooLong extends Schema.TaggedErrorClass()("AccountNameTooLong", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(AccountNameTooLong, [
    { code: 1001, message: { includes: "too long" } },
]);
export class BadRequest extends Schema.TaggedErrorClass()("BadRequest", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(BadRequest, [{ code: 400 }]);
export class EndpointNotFound extends Schema.TaggedErrorClass()("EndpointNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(EndpointNotFound, [{ code: 1199 }]);
export class InvalidAccountName extends Schema.TaggedErrorClass()("InvalidAccountName", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidAccountName, [
    { code: 1001, message: { includes: "invalid character" } },
]);
export class InvalidRoute extends Schema.TaggedErrorClass()("InvalidRoute", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidRoute, [{ code: 7003 }]);
export class InvalidTokenName extends Schema.TaggedErrorClass()("InvalidTokenName", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidTokenName, [
    { code: 400, message: { includes: "name must have a length" } },
]);
export class JsonDecodeFailure extends Schema.TaggedErrorClass()("JsonDecodeFailure", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(JsonDecodeFailure, [{ code: 1198 }]);
export class MemberNotFound extends Schema.TaggedErrorClass()("MemberNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MemberNotFound, [{ code: 1003 }]);
export class MethodNotAllowed extends Schema.TaggedErrorClass()("MethodNotAllowed", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MethodNotAllowed, [
    { code: 7001 },
    { code: 10000 },
    { code: 10405 },
]);
export class MissingAuthenticationToken extends Schema.TaggedErrorClass()("MissingAuthenticationToken", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MissingAuthenticationToken, [{ code: 1001 }]);
export class MissingName extends Schema.TaggedErrorClass()("MissingName", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(MissingName, [{ code: 1001 }]);
export class PermissionGroupNotFound extends Schema.TaggedErrorClass()("PermissionGroupNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(PermissionGroupNotFound, [
    { code: 1001, message: { includes: "Permission group" } },
]);
export class TokenNotFound extends Schema.TaggedErrorClass()("TokenNotFound", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(TokenNotFound, [{ code: 1003 }]);
export class UpdateAccountTypeNotSupported extends Schema.TaggedErrorClass()("UpdateAccountTypeNotSupported", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(UpdateAccountTypeNotSupported, [
    { code: 1001, message: { includes: "account type is not supported" } },
]);
export class ValidationError extends Schema.TaggedErrorClass()("ValidationError", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(ValidationError, [{ code: 1001 }]);
export const GetAccountRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}" }));
export const GetAccountResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    name: Schema.String,
    type: Schema.Literals(["standard", "enterprise"]),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    managedBy: Schema.optional(Schema.Union([
        Schema.Struct({
            parentOrgId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            parentOrgName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            parentOrgId: "parent_org_id",
            parentOrgName: "parent_org_name",
        })),
        Schema.Null,
    ])),
    settings: Schema.optional(Schema.Union([
        Schema.Struct({
            abuseContactEmail: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            enforceTwofactor: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            abuseContactEmail: "abuse_contact_email",
            enforceTwofactor: "enforce_twofactor",
        })),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    name: "name",
    type: "type",
    createdOn: "created_on",
    managedBy: "managed_by",
    settings: "settings",
}))
    .pipe(T.ResponsePath("result"));
export const getAccount = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetAccountRequest,
    output: GetAccountResponse,
    errors: [InvalidRoute],
}));
export const ListAccountsRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({}).pipe(T.Http({ method: "GET", path: "/accounts" }));
export const ListAccountsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        name: Schema.String,
        type: Schema.Literals(["standard", "enterprise"]),
        createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        managedBy: Schema.optional(Schema.Union([
            Schema.Struct({
                parentOrgId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                parentOrgName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }).pipe(Schema.encodeKeys({
                parentOrgId: "parent_org_id",
                parentOrgName: "parent_org_name",
            })),
            Schema.Null,
        ])),
        settings: Schema.optional(Schema.Union([
            Schema.Struct({
                abuseContactEmail: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                enforceTwofactor: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }).pipe(Schema.encodeKeys({
                abuseContactEmail: "abuse_contact_email",
                enforceTwofactor: "enforce_twofactor",
            })),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        name: "name",
        type: "type",
        createdOn: "created_on",
        managedBy: "managed_by",
        settings: "settings",
    }))),
    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 listAccounts = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListAccountsRequest,
    output: ListAccountsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateAccountRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    name: Schema.String,
    type: Schema.optional(Schema.Literals(["standard", "enterprise"])),
    unit: Schema.optional(Schema.Struct({
        id: Schema.optional(Schema.String),
    })),
}).pipe(T.Http({ method: "POST", path: "/accounts" }));
export const CreateAccountResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    name: Schema.String,
    type: Schema.Literals(["standard", "enterprise"]),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    managedBy: Schema.optional(Schema.Union([
        Schema.Struct({
            parentOrgId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            parentOrgName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            parentOrgId: "parent_org_id",
            parentOrgName: "parent_org_name",
        })),
        Schema.Null,
    ])),
    settings: Schema.optional(Schema.Union([
        Schema.Struct({
            abuseContactEmail: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            enforceTwofactor: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            abuseContactEmail: "abuse_contact_email",
            enforceTwofactor: "enforce_twofactor",
        })),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    name: "name",
    type: "type",
    createdOn: "created_on",
    managedBy: "managed_by",
    settings: "settings",
}))
    .pipe(T.ResponsePath("result"));
export const createAccount = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateAccountRequest,
    output: CreateAccountResponse,
    errors: [AccountCreationForbidden, MissingName],
}));
export const UpdateAccountRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    id: Schema.String,
    name: Schema.String,
    type: Schema.optional(Schema.Literals(["standard", "enterprise"])),
    managedBy: Schema.optional(Schema.Unknown),
    settings: Schema.optional(Schema.Struct({
        abuseContactEmail: Schema.optional(Schema.String),
        enforceTwofactor: Schema.optional(Schema.Boolean),
    }).pipe(Schema.encodeKeys({
        abuseContactEmail: "abuse_contact_email",
        enforceTwofactor: "enforce_twofactor",
    }))),
}).pipe(Schema.encodeKeys({
    id: "id",
    name: "name",
    type: "type",
    managedBy: "managed_by",
    settings: "settings",
}), T.Http({ method: "PUT", path: "/accounts/{account_id}" }));
export const UpdateAccountResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    name: Schema.String,
    type: Schema.Literals(["standard", "enterprise"]),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    managedBy: Schema.optional(Schema.Union([
        Schema.Struct({
            parentOrgId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            parentOrgName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            parentOrgId: "parent_org_id",
            parentOrgName: "parent_org_name",
        })),
        Schema.Null,
    ])),
    settings: Schema.optional(Schema.Union([
        Schema.Struct({
            abuseContactEmail: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            enforceTwofactor: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            abuseContactEmail: "abuse_contact_email",
            enforceTwofactor: "enforce_twofactor",
        })),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    name: "name",
    type: "type",
    createdOn: "created_on",
    managedBy: "managed_by",
    settings: "settings",
}))
    .pipe(T.ResponsePath("result"));
export const updateAccount = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateAccountRequest,
    output: UpdateAccountResponse,
    errors: [
        InvalidAccountName,
        AccountNameTooLong,
        UpdateAccountTypeNotSupported,
        InvalidRoute,
        MethodNotAllowed,
    ],
}));
export const DeleteAccountRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "DELETE", path: "/accounts/{account_id}" }));
export const DeleteAccountResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
}).pipe(T.ResponsePath("result"));
export const deleteAccount = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteAccountRequest,
    output: DeleteAccountResponse,
    errors: [InvalidRoute, MethodNotAllowed],
}));
export const ListLogAuditsRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    cursor: Schema.optional(Schema.String).pipe(T.HttpQuery("cursor")),
    before: Schema.String.pipe(T.HttpQuery("before")),
    since: Schema.String.pipe(T.HttpQuery("since")),
    id: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("id")),
    accountName: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("account_name")),
    actionResult: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.Literals(["success", "failure"]))),
    })).pipe(T.HttpQuery("action_result")),
    actionType: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.Literals(["create", "delete", "view", "update"]))),
    })).pipe(T.HttpQuery("action_type")),
    actorContext: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.Literals([
            "api_key",
            "api_token",
            "dash",
            "oauth",
            "origin_ca_key",
        ]))),
    })).pipe(T.HttpQuery("actor_context")),
    actorEmail: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("actor_email")),
    actorId: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("actor_id")),
    actorIpAddress: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("actor_ip_address")),
    actorTokenId: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("actor_token_id")),
    actorTokenName: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("actor_token_name")),
    actorType: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.Literals(["account", "cloudflare_admin", "system", "user"]))),
    })).pipe(T.HttpQuery("actor_type")),
    auditLogId: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("audit_log_id")),
    direction: Schema.optional(Schema.Literals(["desc", "asc"])).pipe(T.HttpQuery("direction")),
    limit: Schema.optional(Schema.Number).pipe(T.HttpQuery("limit")),
    rawCfRayId: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("raw_cf_ray_id")),
    rawMethod: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("raw_method")),
    rawStatusCode: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.Number)),
    })).pipe(T.HttpQuery("raw_status_code")),
    rawUri: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("raw_uri")),
    resourceId: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("resource_id")),
    resourceProduct: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("resource_product")),
    resourceScope: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.Literals(["accounts", "user", "zones"]))),
    })).pipe(T.HttpQuery("resource_scope")),
    resourceType: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("resource_type")),
    zoneId: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("zone_id")),
    zoneName: Schema.optional(Schema.Struct({
        not: Schema.optional(Schema.Array(Schema.String)),
    })).pipe(T.HttpQuery("zone_name")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/logs/audit" }));
export const ListLogAuditsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        account: Schema.optional(Schema.Union([
            Schema.Struct({
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
        action: Schema.optional(Schema.Union([
            Schema.Struct({
                description: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                result: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                time: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                type: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
        actor: Schema.optional(Schema.Union([
            Schema.Struct({
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                context: Schema.optional(Schema.Union([
                    Schema.Literals([
                        "api_key",
                        "api_token",
                        "dash",
                        "oauth",
                        "origin_ca_key",
                    ]),
                    Schema.Null,
                ])),
                email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                ipAddress: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                tokenId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                tokenName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                type: Schema.optional(Schema.Union([
                    Schema.Literals([
                        "account",
                        "cloudflare_admin",
                        "system",
                        "user",
                    ]),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                id: "id",
                context: "context",
                email: "email",
                ipAddress: "ip_address",
                tokenId: "token_id",
                tokenName: "token_name",
                type: "type",
            })),
            Schema.Null,
        ])),
        raw: Schema.optional(Schema.Union([
            Schema.Struct({
                cfRayId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                method: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                statusCode: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
                uri: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                userAgent: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }).pipe(Schema.encodeKeys({
                cfRayId: "cf_ray_id",
                method: "method",
                statusCode: "status_code",
                uri: "uri",
                userAgent: "user_agent",
            })),
            Schema.Null,
        ])),
        resource: Schema.optional(Schema.Union([
            Schema.Struct({
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                product: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                request: Schema.optional(Schema.Union([Schema.Unknown, Schema.Null])),
                response: Schema.optional(Schema.Union([Schema.Unknown, Schema.Null])),
                scope: Schema.optional(Schema.Union([Schema.Unknown, Schema.Null])),
                type: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
        zone: Schema.optional(Schema.Union([
            Schema.Struct({
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
    })),
    resultInfo: Schema.optional(Schema.Union([
        Schema.Struct({
            cursors: Schema.optional(Schema.Union([
                Schema.Struct({
                    after: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                }),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
}).pipe(Schema.encodeKeys({ result: "result", resultInfo: "result_info" }));
export const listLogAudits = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListLogAuditsRequest,
    output: ListLogAuditsResponse,
    errors: [],
    pagination: {
        mode: "cursor",
        inputToken: "cursor",
        outputToken: "resultInfo.cursors.after",
        items: "result",
    },
}));
export const GetMemberRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    memberId: Schema.String.pipe(T.HttpPath("memberId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/members/{memberId}" }));
export const GetMemberResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policies: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            access: Schema.optional(Schema.Union([Schema.Literals(["allow", "deny"]), Schema.Null])),
            permissionGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                })),
                Schema.Null,
            ])),
            resourceGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            access: "access",
            permissionGroups: "permission_groups",
            resourceGroups: "resource_groups",
        }))),
        Schema.Null,
    ])),
    roles: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            description: Schema.String,
            name: Schema.String,
            permissions: Schema.Struct({
                analytics: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                billing: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                cachePurge: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                dns: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                dnsRecords: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                lb: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                logs: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                organization: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                ssl: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                waf: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                zoneSettings: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                zones: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                analytics: "analytics",
                billing: "billing",
                cachePurge: "cache_purge",
                dns: "dns",
                dnsRecords: "dns_records",
                lb: "lb",
                logs: "logs",
                organization: "organization",
                ssl: "ssl",
                waf: "waf",
                zoneSettings: "zone_settings",
                zones: "zones",
            })),
        })),
        Schema.Null,
    ])),
    status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
    user: Schema.optional(Schema.Union([
        Schema.Struct({
            email: Schema.String,
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            firstName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            lastName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            twoFactorAuthenticationEnabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            email: "email",
            id: "id",
            firstName: "first_name",
            lastName: "last_name",
            twoFactorAuthenticationEnabled: "two_factor_authentication_enabled",
        })),
        Schema.Null,
    ])),
}).pipe(T.ResponsePath("result"));
export const getMember = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetMemberRequest,
    output: GetMemberResponse,
    errors: [MemberNotFound, InvalidRoute],
}));
export const ListMembersRequest = /*@__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([
        "user.first_name",
        "user.last_name",
        "user.email",
        "status",
    ])).pipe(T.HttpQuery("order")),
    status: Schema.optional(Schema.Literals(["accepted", "pending", "rejected"])).pipe(T.HttpQuery("status")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/members" }));
export const ListMembersResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        policies: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                access: Schema.optional(Schema.Union([Schema.Literals(["allow", "deny"]), Schema.Null])),
                permissionGroups: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        id: Schema.String,
                    })),
                    Schema.Null,
                ])),
                resourceGroups: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        id: Schema.String,
                    })),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                id: "id",
                access: "access",
                permissionGroups: "permission_groups",
                resourceGroups: "resource_groups",
            }))),
            Schema.Null,
        ])),
        roles: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                id: Schema.String,
                description: Schema.String,
                name: Schema.String,
                permissions: Schema.Struct({
                    analytics: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    billing: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    cachePurge: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    dns: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    dnsRecords: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    lb: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    logs: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    organization: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    ssl: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    waf: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    zoneSettings: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    zones: Schema.optional(Schema.Union([
                        Schema.Struct({
                            read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                            write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                }).pipe(Schema.encodeKeys({
                    analytics: "analytics",
                    billing: "billing",
                    cachePurge: "cache_purge",
                    dns: "dns",
                    dnsRecords: "dns_records",
                    lb: "lb",
                    logs: "logs",
                    organization: "organization",
                    ssl: "ssl",
                    waf: "waf",
                    zoneSettings: "zone_settings",
                    zones: "zones",
                })),
            })),
            Schema.Null,
        ])),
        status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
        user: Schema.optional(Schema.Union([
            Schema.Struct({
                email: Schema.String,
                id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                firstName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                lastName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                twoFactorAuthenticationEnabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }).pipe(Schema.encodeKeys({
                email: "email",
                id: "id",
                firstName: "first_name",
                lastName: "last_name",
                twoFactorAuthenticationEnabled: "two_factor_authentication_enabled",
            })),
            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 listMembers = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListMembersRequest,
    output: ListMembersResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateMemberRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    email: Schema.String,
    roles: Schema.Array(Schema.String),
    status: Schema.optional(Schema.Literals(["accepted", "pending"])),
}).pipe(T.Http({ method: "POST", path: "/accounts/{account_id}/members" }));
export const CreateMemberResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policies: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            access: Schema.optional(Schema.Union([Schema.Literals(["allow", "deny"]), Schema.Null])),
            permissionGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                })),
                Schema.Null,
            ])),
            resourceGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            access: "access",
            permissionGroups: "permission_groups",
            resourceGroups: "resource_groups",
        }))),
        Schema.Null,
    ])),
    roles: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            description: Schema.String,
            name: Schema.String,
            permissions: Schema.Struct({
                analytics: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                billing: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                cachePurge: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                dns: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                dnsRecords: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                lb: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                logs: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                organization: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                ssl: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                waf: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                zoneSettings: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                zones: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                analytics: "analytics",
                billing: "billing",
                cachePurge: "cache_purge",
                dns: "dns",
                dnsRecords: "dns_records",
                lb: "lb",
                logs: "logs",
                organization: "organization",
                ssl: "ssl",
                waf: "waf",
                zoneSettings: "zone_settings",
                zones: "zones",
            })),
        })),
        Schema.Null,
    ])),
    status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
    user: Schema.optional(Schema.Union([
        Schema.Struct({
            email: Schema.String,
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            firstName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            lastName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            twoFactorAuthenticationEnabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            email: "email",
            id: "id",
            firstName: "first_name",
            lastName: "last_name",
            twoFactorAuthenticationEnabled: "two_factor_authentication_enabled",
        })),
        Schema.Null,
    ])),
}).pipe(T.ResponsePath("result"));
export const createMember = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateMemberRequest,
    output: CreateMemberResponse,
    errors: [InvalidRoute, ValidationError],
}));
export const UpdateMemberRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    memberId: Schema.String.pipe(T.HttpPath("memberId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    roles: Schema.optional(Schema.Array(Schema.Struct({
        id: Schema.String,
    }))),
}).pipe(T.Http({ method: "PUT", path: "/accounts/{account_id}/members/{memberId}" }));
export const UpdateMemberResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policies: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            access: Schema.optional(Schema.Union([Schema.Literals(["allow", "deny"]), Schema.Null])),
            permissionGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                })),
                Schema.Null,
            ])),
            resourceGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            access: "access",
            permissionGroups: "permission_groups",
            resourceGroups: "resource_groups",
        }))),
        Schema.Null,
    ])),
    roles: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            description: Schema.String,
            name: Schema.String,
            permissions: Schema.Struct({
                analytics: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                billing: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                cachePurge: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                dns: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                dnsRecords: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                lb: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                logs: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                organization: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                ssl: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                waf: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                zoneSettings: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                zones: Schema.optional(Schema.Union([
                    Schema.Struct({
                        read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                        write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                analytics: "analytics",
                billing: "billing",
                cachePurge: "cache_purge",
                dns: "dns",
                dnsRecords: "dns_records",
                lb: "lb",
                logs: "logs",
                organization: "organization",
                ssl: "ssl",
                waf: "waf",
                zoneSettings: "zone_settings",
                zones: "zones",
            })),
        })),
        Schema.Null,
    ])),
    status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
    user: Schema.optional(Schema.Union([
        Schema.Struct({
            email: Schema.String,
            id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            firstName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            lastName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            twoFactorAuthenticationEnabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        }).pipe(Schema.encodeKeys({
            email: "email",
            id: "id",
            firstName: "first_name",
            lastName: "last_name",
            twoFactorAuthenticationEnabled: "two_factor_authentication_enabled",
        })),
        Schema.Null,
    ])),
}).pipe(T.ResponsePath("result"));
export const updateMember = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateMemberRequest,
    output: UpdateMemberResponse,
    errors: [MemberNotFound, InvalidRoute, BadRequest, MethodNotAllowed],
}));
export const DeleteMemberRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    memberId: Schema.String.pipe(T.HttpPath("memberId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/members/{memberId}",
}));
export const DeleteMemberResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
}).pipe(T.ResponsePath("result"));
export const deleteMember = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteMemberRequest,
    output: DeleteMemberResponse,
    errors: [MemberNotFound, InvalidRoute],
}));
export const GetRoleRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    roleId: Schema.String.pipe(T.HttpPath("roleId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/roles/{roleId}" }));
export const GetRoleResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    description: Schema.String,
    name: Schema.String,
    permissions: Schema.Struct({
        analytics: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        billing: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        cachePurge: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        dns: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        dnsRecords: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        lb: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        logs: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        organization: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        ssl: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        waf: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        zoneSettings: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
        zones: Schema.optional(Schema.Union([
            Schema.Struct({
                read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            }),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        analytics: "analytics",
        billing: "billing",
        cachePurge: "cache_purge",
        dns: "dns",
        dnsRecords: "dns_records",
        lb: "lb",
        logs: "logs",
        organization: "organization",
        ssl: "ssl",
        waf: "waf",
        zoneSettings: "zone_settings",
        zones: "zones",
    })),
}).pipe(T.ResponsePath("result"));
export const getRole = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetRoleRequest,
    output: GetRoleResponse,
    errors: [InvalidRoute],
}));
export const ListRolesRequest = /*@__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")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/roles" }));
export const ListRolesResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        description: Schema.String,
        name: Schema.String,
        permissions: Schema.Struct({
            analytics: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            billing: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            cachePurge: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            dns: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            dnsRecords: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            lb: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            logs: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            organization: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            ssl: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            waf: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            zoneSettings: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
            zones: Schema.optional(Schema.Union([
                Schema.Struct({
                    read: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                    write: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                }),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            analytics: "analytics",
            billing: "billing",
            cachePurge: "cache_purge",
            dns: "dns",
            dnsRecords: "dns_records",
            lb: "lb",
            logs: "logs",
            organization: "organization",
            ssl: "ssl",
            waf: "waf",
            zoneSettings: "zone_settings",
            zones: "zones",
        })),
    })),
    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 listRoles = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListRolesRequest,
    output: ListRolesResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const GetSubscriptionRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/subscriptions" }));
export const GetSubscriptionResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        currency: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        currentPeriodEnd: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        currentPeriodStart: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        frequency: Schema.optional(Schema.Union([
            Schema.Literals(["weekly", "monthly", "quarterly", "yearly"]),
            Schema.Null,
        ])),
        price: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
        ratePlan: Schema.optional(Schema.Union([
            Schema.Struct({
                id: Schema.optional(Schema.Union([
                    Schema.Literals([
                        "free",
                        "lite",
                        "pro",
                        "pro_plus",
                        "business",
                        "enterprise",
                        "partners_free",
                        "partners_pro",
                        "partners_business",
                        "partners_enterprise",
                    ]),
                    Schema.Null,
                ])),
                currency: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                externallyManaged: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                isContract: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
                publicName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                scope: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                sets: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
            }).pipe(Schema.encodeKeys({
                id: "id",
                currency: "currency",
                externallyManaged: "externally_managed",
                isContract: "is_contract",
                publicName: "public_name",
                scope: "scope",
                sets: "sets",
            })),
            Schema.Null,
        ])),
        state: Schema.optional(Schema.Union([
            Schema.Literals([
                "Trial",
                "Provisioned",
                "Paid",
                "AwaitingPayment",
                "Cancelled",
                "Failed",
                "Expired",
            ]),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        currency: "currency",
        currentPeriodEnd: "current_period_end",
        currentPeriodStart: "current_period_start",
        frequency: "frequency",
        price: "price",
        ratePlan: "rate_plan",
        state: "state",
    }))),
});
export const getSubscription = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: GetSubscriptionRequest,
    output: GetSubscriptionResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateSubscriptionRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    frequency: Schema.optional(Schema.Literals(["weekly", "monthly", "quarterly", "yearly"])),
    ratePlan: Schema.optional(Schema.Struct({
        id: Schema.optional(Schema.Literals([
            "free",
            "lite",
            "pro",
            "pro_plus",
            "business",
            "enterprise",
            "partners_free",
            "partners_pro",
            "partners_business",
            "partners_enterprise",
        ])),
        currency: Schema.optional(Schema.String),
        externallyManaged: Schema.optional(Schema.Boolean),
        isContract: Schema.optional(Schema.Boolean),
        publicName: Schema.optional(Schema.String),
        scope: Schema.optional(Schema.String),
        sets: Schema.optional(Schema.Array(Schema.String)),
    }).pipe(Schema.encodeKeys({
        id: "id",
        currency: "currency",
        externallyManaged: "externally_managed",
        isContract: "is_contract",
        publicName: "public_name",
        scope: "scope",
        sets: "sets",
    }))),
}).pipe(Schema.encodeKeys({ frequency: "frequency", ratePlan: "rate_plan" }), T.Http({ method: "POST", path: "/accounts/{account_id}/subscriptions" }));
export const CreateSubscriptionResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    currency: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    currentPeriodEnd: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    currentPeriodStart: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    frequency: Schema.optional(Schema.Union([
        Schema.Literals(["weekly", "monthly", "quarterly", "yearly"]),
        Schema.Null,
    ])),
    price: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    ratePlan: Schema.optional(Schema.Union([
        Schema.Struct({
            id: Schema.optional(Schema.Union([
                Schema.Literals([
                    "free",
                    "lite",
                    "pro",
                    "pro_plus",
                    "business",
                    "enterprise",
                    "partners_free",
                    "partners_pro",
                    "partners_business",
                    "partners_enterprise",
                ]),
                Schema.Null,
            ])),
            currency: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            externallyManaged: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            isContract: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            publicName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            scope: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            sets: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            currency: "currency",
            externallyManaged: "externally_managed",
            isContract: "is_contract",
            publicName: "public_name",
            scope: "scope",
            sets: "sets",
        })),
        Schema.Null,
    ])),
    state: Schema.optional(Schema.Union([
        Schema.Literals([
            "Trial",
            "Provisioned",
            "Paid",
            "AwaitingPayment",
            "Cancelled",
            "Failed",
            "Expired",
        ]),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    currency: "currency",
    currentPeriodEnd: "current_period_end",
    currentPeriodStart: "current_period_start",
    frequency: "frequency",
    price: "price",
    ratePlan: "rate_plan",
    state: "state",
}))
    .pipe(T.ResponsePath("result"));
export const createSubscription = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateSubscriptionRequest,
    output: CreateSubscriptionResponse,
    errors: [JsonDecodeFailure, InvalidRoute],
}));
export const UpdateSubscriptionRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    subscriptionIdentifier: Schema.String.pipe(T.HttpPath("subscriptionIdentifier")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    frequency: Schema.optional(Schema.Literals(["weekly", "monthly", "quarterly", "yearly"])),
    ratePlan: Schema.optional(Schema.Struct({
        id: Schema.optional(Schema.Literals([
            "free",
            "lite",
            "pro",
            "pro_plus",
            "business",
            "enterprise",
            "partners_free",
            "partners_pro",
            "partners_business",
            "partners_enterprise",
        ])),
        currency: Schema.optional(Schema.String),
        externallyManaged: Schema.optional(Schema.Boolean),
        isContract: Schema.optional(Schema.Boolean),
        publicName: Schema.optional(Schema.String),
        scope: Schema.optional(Schema.String),
        sets: Schema.optional(Schema.Array(Schema.String)),
    }).pipe(Schema.encodeKeys({
        id: "id",
        currency: "currency",
        externallyManaged: "externally_managed",
        isContract: "is_contract",
        publicName: "public_name",
        scope: "scope",
        sets: "sets",
    }))),
}).pipe(Schema.encodeKeys({ frequency: "frequency", ratePlan: "rate_plan" }), T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/subscriptions/{subscriptionIdentifier}",
}));
export const UpdateSubscriptionResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    currency: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    currentPeriodEnd: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    currentPeriodStart: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    frequency: Schema.optional(Schema.Union([
        Schema.Literals(["weekly", "monthly", "quarterly", "yearly"]),
        Schema.Null,
    ])),
    price: Schema.optional(Schema.Union([Schema.Number, Schema.Null])),
    ratePlan: Schema.optional(Schema.Union([
        Schema.Struct({
            id: Schema.optional(Schema.Union([
                Schema.Literals([
                    "free",
                    "lite",
                    "pro",
                    "pro_plus",
                    "business",
                    "enterprise",
                    "partners_free",
                    "partners_pro",
                    "partners_business",
                    "partners_enterprise",
                ]),
                Schema.Null,
            ])),
            currency: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            externallyManaged: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            isContract: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
            publicName: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            scope: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            sets: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            currency: "currency",
            externallyManaged: "externally_managed",
            isContract: "is_contract",
            publicName: "public_name",
            scope: "scope",
            sets: "sets",
        })),
        Schema.Null,
    ])),
    state: Schema.optional(Schema.Union([
        Schema.Literals([
            "Trial",
            "Provisioned",
            "Paid",
            "AwaitingPayment",
            "Cancelled",
            "Failed",
            "Expired",
        ]),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    currency: "currency",
    currentPeriodEnd: "current_period_end",
    currentPeriodStart: "current_period_start",
    frequency: "frequency",
    price: "price",
    ratePlan: "rate_plan",
    state: "state",
}))
    .pipe(T.ResponsePath("result"));
export const updateSubscription = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateSubscriptionRequest,
    output: UpdateSubscriptionResponse,
    errors: [JsonDecodeFailure, InvalidRoute, EndpointNotFound],
}));
export const DeleteSubscriptionRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    subscriptionIdentifier: Schema.String.pipe(T.HttpPath("subscriptionIdentifier")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/subscriptions/{subscriptionIdentifier}",
}));
export const DeleteSubscriptionResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    subscriptionId: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({ subscriptionId: "subscription_id" }))
    .pipe(T.ResponsePath("result"));
export const deleteSubscription = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteSubscriptionRequest,
    output: DeleteSubscriptionResponse,
    errors: [InvalidRoute, EndpointNotFound],
}));
export const GetTokenRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    tokenId: Schema.String.pipe(T.HttpPath("tokenId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/tokens/{tokenId}" }));
export const GetTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    condition: Schema.optional(Schema.Union([
        Schema.Struct({
            requestIp: Schema.optional(Schema.Union([
                Schema.Struct({
                    in: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    notIn: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({ in: "in", notIn: "not_in" })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({ requestIp: "request_ip" })),
        Schema.Null,
    ])),
    expiresOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    issuedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastUsedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    notBefore: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policies: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            effect: Schema.Literals(["allow", "deny"]),
            permissionGroups: Schema.Array(Schema.Struct({
                id: Schema.String,
                meta: Schema.optional(Schema.Union([
                    Schema.Struct({
                        key: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            })),
            resources: Schema.Record(Schema.String, Schema.Unknown),
        }).pipe(Schema.encodeKeys({
            id: "id",
            effect: "effect",
            permissionGroups: "permission_groups",
            resources: "resources",
        }))),
        Schema.Null,
    ])),
    status: Schema.optional(Schema.Union([
        Schema.Literals(["active", "disabled", "expired"]),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    condition: "condition",
    expiresOn: "expires_on",
    issuedOn: "issued_on",
    lastUsedOn: "last_used_on",
    modifiedOn: "modified_on",
    name: "name",
    notBefore: "not_before",
    policies: "policies",
    status: "status",
}))
    .pipe(T.ResponsePath("result"));
export const getToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetTokenRequest,
    output: GetTokenResponse,
    errors: [InvalidRoute, TokenNotFound],
}));
export const ListTokensRequest = /*@__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")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/tokens" }));
export const ListTokensResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        condition: Schema.optional(Schema.Union([
            Schema.Struct({
                requestIp: Schema.optional(Schema.Union([
                    Schema.Struct({
                        in: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                        notIn: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    }).pipe(Schema.encodeKeys({ in: "in", notIn: "not_in" })),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({ requestIp: "request_ip" })),
            Schema.Null,
        ])),
        expiresOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        issuedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        lastUsedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        notBefore: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        policies: Schema.optional(Schema.Union([
            Schema.Array(Schema.Struct({
                id: Schema.String,
                effect: Schema.Literals(["allow", "deny"]),
                permissionGroups: Schema.Array(Schema.Struct({
                    id: Schema.String,
                    meta: Schema.optional(Schema.Union([
                        Schema.Struct({
                            key: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                            value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        }),
                        Schema.Null,
                    ])),
                    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                })),
                resources: Schema.Record(Schema.String, Schema.Unknown),
            }).pipe(Schema.encodeKeys({
                id: "id",
                effect: "effect",
                permissionGroups: "permission_groups",
                resources: "resources",
            }))),
            Schema.Null,
        ])),
        status: Schema.optional(Schema.Union([
            Schema.Literals(["active", "disabled", "expired"]),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        condition: "condition",
        expiresOn: "expires_on",
        issuedOn: "issued_on",
        lastUsedOn: "last_used_on",
        modifiedOn: "modified_on",
        name: "name",
        notBefore: "not_before",
        policies: "policies",
        status: "status",
    }))),
    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 listTokens = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListTokensRequest,
    output: ListTokensResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateTokenRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    policies: Schema.Array(Schema.Struct({
        effect: Schema.Literals(["allow", "deny"]),
        permissionGroups: Schema.Array(Schema.Struct({
            id: Schema.String,
            meta: Schema.optional(Schema.Struct({
                key: Schema.optional(Schema.String),
                value: Schema.optional(Schema.String),
            })),
        })),
        resources: Schema.Record(Schema.String, Schema.Unknown),
    }).pipe(Schema.encodeKeys({
        effect: "effect",
        permissionGroups: "permission_groups",
        resources: "resources",
    }))),
    condition: Schema.optional(Schema.Struct({
        requestIp: Schema.optional(Schema.Struct({
            in: Schema.optional(Schema.Array(Schema.String)),
            notIn: Schema.optional(Schema.Array(Schema.String)),
        }).pipe(Schema.encodeKeys({ in: "in", notIn: "not_in" }))),
    }).pipe(Schema.encodeKeys({ requestIp: "request_ip" }))),
    expiresOn: Schema.optional(Schema.String),
    notBefore: Schema.optional(Schema.String),
}).pipe(Schema.encodeKeys({
    name: "name",
    policies: "policies",
    condition: "condition",
    expiresOn: "expires_on",
    notBefore: "not_before",
}), T.Http({ method: "POST", path: "/accounts/{account_id}/tokens" }));
export const CreateTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    condition: Schema.optional(Schema.Union([
        Schema.Struct({
            requestIp: Schema.optional(Schema.Union([
                Schema.Struct({
                    in: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    notIn: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({ in: "in", notIn: "not_in" })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({ requestIp: "request_ip" })),
        Schema.Null,
    ])),
    expiresOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    issuedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastUsedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    notBefore: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policies: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            effect: Schema.Literals(["allow", "deny"]),
            permissionGroups: Schema.Array(Schema.Struct({
                id: Schema.String,
                meta: Schema.optional(Schema.Union([
                    Schema.Struct({
                        key: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            })),
            resources: Schema.Record(Schema.String, Schema.Unknown),
        }).pipe(Schema.encodeKeys({
            id: "id",
            effect: "effect",
            permissionGroups: "permission_groups",
            resources: "resources",
        }))),
        Schema.Null,
    ])),
    status: Schema.optional(Schema.Union([
        Schema.Literals(["active", "disabled", "expired"]),
        Schema.Null,
    ])),
    value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    condition: "condition",
    expiresOn: "expires_on",
    issuedOn: "issued_on",
    lastUsedOn: "last_used_on",
    modifiedOn: "modified_on",
    name: "name",
    notBefore: "not_before",
    policies: "policies",
    status: "status",
    value: "value",
}))
    .pipe(T.ResponsePath("result"));
export const createToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateTokenRequest,
    output: CreateTokenResponse,
    errors: [InvalidRoute, InvalidTokenName, PermissionGroupNotFound],
}));
export const UpdateTokenRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    tokenId: Schema.String.pipe(T.HttpPath("tokenId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    policies: Schema.Array(Schema.Struct({
        effect: Schema.Literals(["allow", "deny"]),
        permissionGroups: Schema.Array(Schema.Struct({
            id: Schema.String,
            meta: Schema.optional(Schema.Struct({
                key: Schema.optional(Schema.String),
                value: Schema.optional(Schema.String),
            })),
        })),
        resources: Schema.Record(Schema.String, Schema.Unknown),
    }).pipe(Schema.encodeKeys({
        effect: "effect",
        permissionGroups: "permission_groups",
        resources: "resources",
    }))),
    condition: Schema.optional(Schema.Struct({
        requestIp: Schema.optional(Schema.Struct({
            in: Schema.optional(Schema.Array(Schema.String)),
            notIn: Schema.optional(Schema.Array(Schema.String)),
        }).pipe(Schema.encodeKeys({ in: "in", notIn: "not_in" }))),
    }).pipe(Schema.encodeKeys({ requestIp: "request_ip" }))),
    expiresOn: Schema.optional(Schema.String),
    notBefore: Schema.optional(Schema.String),
    status: Schema.optional(Schema.Literals(["active", "disabled", "expired"])),
}).pipe(Schema.encodeKeys({
    name: "name",
    policies: "policies",
    condition: "condition",
    expiresOn: "expires_on",
    notBefore: "not_before",
    status: "status",
}), T.Http({ method: "PUT", path: "/accounts/{account_id}/tokens/{tokenId}" }));
export const UpdateTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    condition: Schema.optional(Schema.Union([
        Schema.Struct({
            requestIp: Schema.optional(Schema.Union([
                Schema.Struct({
                    in: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                    notIn: Schema.optional(Schema.Union([Schema.Array(Schema.String), Schema.Null])),
                }).pipe(Schema.encodeKeys({ in: "in", notIn: "not_in" })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({ requestIp: "request_ip" })),
        Schema.Null,
    ])),
    expiresOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    issuedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    lastUsedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    modifiedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    notBefore: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    policies: Schema.optional(Schema.Union([
        Schema.Array(Schema.Struct({
            id: Schema.String,
            effect: Schema.Literals(["allow", "deny"]),
            permissionGroups: Schema.Array(Schema.Struct({
                id: Schema.String,
                meta: Schema.optional(Schema.Union([
                    Schema.Struct({
                        key: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                        value: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                    }),
                    Schema.Null,
                ])),
                name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            })),
            resources: Schema.Record(Schema.String, Schema.Unknown),
        }).pipe(Schema.encodeKeys({
            id: "id",
            effect: "effect",
            permissionGroups: "permission_groups",
            resources: "resources",
        }))),
        Schema.Null,
    ])),
    status: Schema.optional(Schema.Union([
        Schema.Literals(["active", "disabled", "expired"]),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    condition: "condition",
    expiresOn: "expires_on",
    issuedOn: "issued_on",
    lastUsedOn: "last_used_on",
    modifiedOn: "modified_on",
    name: "name",
    notBefore: "not_before",
    policies: "policies",
    status: "status",
}))
    .pipe(T.ResponsePath("result"));
export const updateToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateTokenRequest,
    output: UpdateTokenResponse,
    errors: [
        InvalidRoute,
        MethodNotAllowed,
        TokenNotFound,
        PermissionGroupNotFound,
    ],
}));
export const DeleteTokenRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    tokenId: Schema.String.pipe(T.HttpPath("tokenId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "DELETE", path: "/accounts/{account_id}/tokens/{tokenId}" }));
export const DeleteTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
}).pipe(T.ResponsePath("result"));
export const deleteToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteTokenRequest,
    output: DeleteTokenResponse,
    errors: [InvalidRoute, MethodNotAllowed, TokenNotFound],
}));
export const VerifyTokenRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/tokens/verify" }));
export const VerifyTokenResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    status: Schema.Literals(["active", "disabled", "expired"]),
    expiresOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    notBefore: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    status: "status",
    expiresOn: "expires_on",
    notBefore: "not_before",
}))
    .pipe(T.ResponsePath("result"));
export const verifyToken = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: VerifyTokenRequest,
    output: VerifyTokenResponse,
    errors: [MissingAuthenticationToken, InvalidRoute],
}));
export const GetTokenPermissionGroupRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.optional(Schema.String).pipe(T.HttpQuery("name")),
    scope: Schema.optional(Schema.String).pipe(T.HttpQuery("scope")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/tokens/permission_groups",
}));
export const GetTokenPermissionGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Array(Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    scopes: Schema.optional(Schema.Union([
        Schema.Array(Schema.Literals([
            "com.cloudflare.api.account",
            "com.cloudflare.api.account.zone",
            "com.cloudflare.api.user",
            "com.cloudflare.edge.r2.bucket",
        ])),
        Schema.Null,
    ])),
})).pipe(T.ResponsePath("result"));
export const getTokenPermissionGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetTokenPermissionGroupRequest,
    output: GetTokenPermissionGroupResponse,
    errors: [InvalidRoute],
}));
export const ListTokenPermissionGroupsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.optional(Schema.String).pipe(T.HttpQuery("name")),
    scope: Schema.optional(Schema.String).pipe(T.HttpQuery("scope")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/tokens/permission_groups",
}));
export const ListTokenPermissionGroupsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        name: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        scopes: Schema.optional(Schema.Union([
            Schema.Array(Schema.Literals([
                "com.cloudflare.api.account",
                "com.cloudflare.api.account.zone",
                "com.cloudflare.api.user",
                "com.cloudflare.edge.r2.bucket",
            ])),
            Schema.Null,
        ])),
    })),
});
export const listTokenPermissionGroups = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListTokenPermissionGroupsRequest,
    output: ListTokenPermissionGroupsResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const PutTokenValueRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    tokenId: Schema.String.pipe(T.HttpPath("tokenId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    body: Schema.Unknown.pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/tokens/{tokenId}/value",
}));
export const PutTokenValueResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.String.pipe(T.ResponsePath("result"));
export const putTokenValue = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PutTokenValueRequest,
    output: PutTokenValueResponse,
    errors: [InvalidRoute, TokenNotFound],
}));
//# sourceMappingURL=accounts.js.map