/**
 * Cloudflare IAM API
 *
 * Generated from Cloudflare TypeScript SDK.
 * DO NOT EDIT - regenerate with: bun scripts/generate.ts --service iam
 */
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 InvalidMember extends Schema.TaggedErrorClass()("InvalidMember", { code: Schema.Number, message: Schema.String }) {
}
T.applyErrorMatchers(InvalidMember, [{ code: 400 }]);
export const GetPermissionGroupRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    permissionGroupId: Schema.String.pipe(T.HttpPath("permissionGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/iam/permission_groups/{permissionGroupId}",
}));
export const GetPermissionGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ 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])),
}).pipe(T.ResponsePath("result"));
export const getPermissionGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetPermissionGroupRequest,
    output: GetPermissionGroupResponse,
    errors: [],
}));
export const ListPermissionGroupsRequest = 
/*@__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")),
    id: Schema.optional(Schema.String).pipe(T.HttpQuery("id")),
    label: Schema.optional(Schema.String).pipe(T.HttpQuery("label")),
    name: Schema.optional(Schema.String).pipe(T.HttpQuery("name")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/iam/permission_groups",
}));
export const ListPermissionGroupsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: 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])),
    })),
    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 listPermissionGroups = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListPermissionGroupsRequest,
    output: ListPermissionGroupsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const GetResourceGroupRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    resourceGroupId: Schema.String.pipe(T.HttpPath("resourceGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/iam/resource_groups/{resourceGroupId}",
}));
export const GetResourceGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    scope: Schema.Unknown,
    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])),
}).pipe(T.ResponsePath("result"));
export const getResourceGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetResourceGroupRequest,
    output: GetResourceGroupResponse,
    errors: [],
}));
export const ListResourceGroupsRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    id: Schema.optional(Schema.String).pipe(T.HttpQuery("id")),
    name: Schema.optional(Schema.String).pipe(T.HttpQuery("name")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/iam/resource_groups",
}));
export const ListResourceGroupsResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        scope: Schema.Unknown,
        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])),
    })),
});
export const listResourceGroups = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListResourceGroupsRequest,
    output: ListResourceGroupsResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateResourceGroupRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    scope: Schema.Struct({
        key: Schema.String,
        objects: Schema.Array(Schema.Struct({
            key: Schema.String,
        })),
    }),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/iam/resource_groups",
}));
export const CreateResourceGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    scope: Schema.Unknown,
    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])),
}).pipe(T.ResponsePath("result"));
export const createResourceGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateResourceGroupRequest,
    output: CreateResourceGroupResponse,
    errors: [],
}));
export const UpdateResourceGroupRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    resourceGroupId: Schema.String.pipe(T.HttpPath("resourceGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.optional(Schema.String),
    scope: Schema.optional(Schema.Struct({
        key: Schema.String,
        objects: Schema.Array(Schema.Struct({
            key: Schema.String,
        })),
    })),
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/iam/resource_groups/{resourceGroupId}",
}));
export const UpdateResourceGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    scope: Schema.Unknown,
    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])),
}).pipe(T.ResponsePath("result"));
export const updateResourceGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateResourceGroupRequest,
    output: UpdateResourceGroupResponse,
    errors: [],
}));
export const DeleteResourceGroupRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    resourceGroupId: Schema.String.pipe(T.HttpPath("resourceGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/iam/resource_groups/{resourceGroupId}",
}));
export const DeleteResourceGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
}).pipe(T.ResponsePath("result"));
export const deleteResourceGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteResourceGroupRequest,
    output: DeleteResourceGroupResponse,
    errors: [],
}));
export const GetSsoRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ssoConnectorId: Schema.String.pipe(T.HttpPath("ssoConnectorId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/sso_connectors/{ssoConnectorId}",
}));
export const GetSsoResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    emailDomain: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    updatedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    useFedrampLanguage: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    verification: Schema.optional(Schema.Union([
        Schema.Struct({
            code: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            status: Schema.optional(Schema.Union([
                Schema.Literals(["awaiting", "pending", "failed", "verified"]),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdOn: "created_on",
    emailDomain: "email_domain",
    enabled: "enabled",
    updatedOn: "updated_on",
    useFedrampLanguage: "use_fedramp_language",
    verification: "verification",
}))
    .pipe(T.ResponsePath("result"));
export const getSso = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetSsoRequest,
    output: GetSsoResponse,
    errors: [],
}));
export const ListSsosRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/sso_connectors" }));
export const ListSsosResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        emailDomain: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        updatedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        useFedrampLanguage: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
        verification: Schema.optional(Schema.Union([
            Schema.Struct({
                code: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
                status: Schema.optional(Schema.Union([
                    Schema.Literals(["awaiting", "pending", "failed", "verified"]),
                    Schema.Null,
                ])),
            }),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        createdOn: "created_on",
        emailDomain: "email_domain",
        enabled: "enabled",
        updatedOn: "updated_on",
        useFedrampLanguage: "use_fedramp_language",
        verification: "verification",
    }))),
});
export const listSsos = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListSsosRequest,
    output: ListSsosResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const CreateSsoRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    emailDomain: Schema.String,
    beginVerification: Schema.optional(Schema.Boolean),
    useFedrampLanguage: Schema.optional(Schema.Boolean),
}).pipe(Schema.encodeKeys({
    emailDomain: "email_domain",
    beginVerification: "begin_verification",
    useFedrampLanguage: "use_fedramp_language",
}), T.Http({ method: "POST", path: "/accounts/{account_id}/sso_connectors" }));
export const CreateSsoResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    emailDomain: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    updatedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    useFedrampLanguage: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    verification: Schema.optional(Schema.Union([
        Schema.Struct({
            code: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            status: Schema.optional(Schema.Union([
                Schema.Literals(["awaiting", "pending", "failed", "verified"]),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdOn: "created_on",
    emailDomain: "email_domain",
    enabled: "enabled",
    updatedOn: "updated_on",
    useFedrampLanguage: "use_fedramp_language",
    verification: "verification",
}))
    .pipe(T.ResponsePath("result"));
export const createSso = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateSsoRequest,
    output: CreateSsoResponse,
    errors: [],
}));
export const PatchSsoRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ssoConnectorId: Schema.String.pipe(T.HttpPath("ssoConnectorId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    enabled: Schema.optional(Schema.Boolean),
    useFedrampLanguage: Schema.optional(Schema.Boolean),
}).pipe(Schema.encodeKeys({
    enabled: "enabled",
    useFedrampLanguage: "use_fedramp_language",
}), T.Http({
    method: "PATCH",
    path: "/accounts/{account_id}/sso_connectors/{ssoConnectorId}",
}));
export const PatchSsoResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    createdOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    emailDomain: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    enabled: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    updatedOn: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    useFedrampLanguage: Schema.optional(Schema.Union([Schema.Boolean, Schema.Null])),
    verification: Schema.optional(Schema.Union([
        Schema.Struct({
            code: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            status: Schema.optional(Schema.Union([
                Schema.Literals(["awaiting", "pending", "failed", "verified"]),
                Schema.Null,
            ])),
        }),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdOn: "created_on",
    emailDomain: "email_domain",
    enabled: "enabled",
    updatedOn: "updated_on",
    useFedrampLanguage: "use_fedramp_language",
    verification: "verification",
}))
    .pipe(T.ResponsePath("result"));
export const patchSso = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: PatchSsoRequest,
    output: PatchSsoResponse,
    errors: [],
}));
export const DeleteSsoRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ssoConnectorId: Schema.String.pipe(T.HttpPath("ssoConnectorId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/sso_connectors/{ssoConnectorId}",
}));
export const DeleteSsoResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
}).pipe(T.ResponsePath("result"));
export const deleteSso = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteSsoRequest,
    output: DeleteSsoResponse,
    errors: [],
}));
export const GetUserGroupRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "GET",
    path: "/accounts/{account_id}/iam/user_groups/{userGroupId}",
}));
export const GetUserGroupResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    createdOn: Schema.String,
    modifiedOn: Schema.String,
    name: Schema.String,
    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,
                    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])),
                })),
                Schema.Null,
            ])),
            resourceGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                    scope: Schema.Unknown,
                    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])),
                })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            access: "access",
            permissionGroups: "permission_groups",
            resourceGroups: "resource_groups",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdOn: "created_on",
    modifiedOn: "modified_on",
    name: "name",
    policies: "policies",
}))
    .pipe(T.ResponsePath("result"));
export const getUserGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: GetUserGroupRequest,
    output: GetUserGroupResponse,
    errors: [],
}));
export const ListUserGroupsRequest = /*@__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")),
    id: Schema.optional(Schema.String).pipe(T.HttpQuery("id")),
    direction: Schema.optional(Schema.String).pipe(T.HttpQuery("direction")),
    fuzzyName: Schema.optional(Schema.String).pipe(T.HttpQuery("fuzzyName")),
    name: Schema.optional(Schema.String).pipe(T.HttpQuery("name")),
}).pipe(T.Http({ method: "GET", path: "/accounts/{account_id}/iam/user_groups" }));
export const ListUserGroupsResponse = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        createdOn: Schema.String,
        modifiedOn: Schema.String,
        name: Schema.String,
        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,
                        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])),
                    })),
                    Schema.Null,
                ])),
                resourceGroups: Schema.optional(Schema.Union([
                    Schema.Array(Schema.Struct({
                        id: Schema.String,
                        scope: Schema.Unknown,
                        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])),
                    })),
                    Schema.Null,
                ])),
            }).pipe(Schema.encodeKeys({
                id: "id",
                access: "access",
                permissionGroups: "permission_groups",
                resourceGroups: "resource_groups",
            }))),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        id: "id",
        createdOn: "created_on",
        modifiedOn: "modified_on",
        name: "name",
        policies: "policies",
    }))),
    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 listUserGroups = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListUserGroupsRequest,
    output: ListUserGroupsResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateUserGroupRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.String,
    policies: Schema.Array(Schema.Struct({
        access: Schema.Literals(["allow", "deny"]),
        permissionGroups: Schema.Array(Schema.Struct({
            id: Schema.String,
        })),
        resourceGroups: Schema.Array(Schema.Struct({
            id: Schema.String,
        })),
    }).pipe(Schema.encodeKeys({
        access: "access",
        permissionGroups: "permission_groups",
        resourceGroups: "resource_groups",
    }))),
}).pipe(T.Http({ method: "POST", path: "/accounts/{account_id}/iam/user_groups" }));
export const CreateUserGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    createdOn: Schema.String,
    modifiedOn: Schema.String,
    name: Schema.String,
    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,
                    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])),
                })),
                Schema.Null,
            ])),
            resourceGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                    scope: Schema.Unknown,
                    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])),
                })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            access: "access",
            permissionGroups: "permission_groups",
            resourceGroups: "resource_groups",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdOn: "created_on",
    modifiedOn: "modified_on",
    name: "name",
    policies: "policies",
}))
    .pipe(T.ResponsePath("result"));
export const createUserGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateUserGroupRequest,
    output: CreateUserGroupResponse,
    errors: [],
}));
export const UpdateUserGroupRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    name: Schema.optional(Schema.String),
    policies: Schema.optional(Schema.Array(Schema.Struct({
        id: Schema.String,
        access: Schema.Literals(["allow", "deny"]),
        permissionGroups: Schema.Array(Schema.Struct({
            id: Schema.String,
        })),
        resourceGroups: Schema.Array(Schema.Struct({
            id: Schema.String,
        })),
    }).pipe(Schema.encodeKeys({
        id: "id",
        access: "access",
        permissionGroups: "permission_groups",
        resourceGroups: "resource_groups",
    })))),
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/iam/user_groups/{userGroupId}",
}));
export const UpdateUserGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    createdOn: Schema.String,
    modifiedOn: Schema.String,
    name: Schema.String,
    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,
                    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])),
                })),
                Schema.Null,
            ])),
            resourceGroups: Schema.optional(Schema.Union([
                Schema.Array(Schema.Struct({
                    id: Schema.String,
                    scope: Schema.Unknown,
                    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])),
                })),
                Schema.Null,
            ])),
        }).pipe(Schema.encodeKeys({
            id: "id",
            access: "access",
            permissionGroups: "permission_groups",
            resourceGroups: "resource_groups",
        }))),
        Schema.Null,
    ])),
})
    .pipe(Schema.encodeKeys({
    id: "id",
    createdOn: "created_on",
    modifiedOn: "modified_on",
    name: "name",
    policies: "policies",
}))
    .pipe(T.ResponsePath("result"));
export const updateUserGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: UpdateUserGroupRequest,
    output: UpdateUserGroupResponse,
    errors: [],
}));
export const DeleteUserGroupRequest = /*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/iam/user_groups/{userGroupId}",
}));
export const DeleteUserGroupResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
}).pipe(T.ResponsePath("result"));
export const deleteUserGroup = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteUserGroupRequest,
    output: DeleteUserGroupResponse,
    errors: [],
}));
export const ListUserGroupMembersRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    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}/iam/user_groups/{userGroupId}/members",
}));
export const ListUserGroupMembersResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), 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 listUserGroupMembers = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: ListUserGroupMembersRequest,
    output: ListUserGroupMembersResponse,
    errors: [],
    pagination: {
        mode: "page",
        inputToken: "page",
        outputToken: "resultInfo.page",
        items: "result",
        pageSize: "perPage",
    },
}));
export const CreateUserGroupMemberRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    body: Schema.Array(Schema.Struct({
        id: Schema.String,
    })).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/iam/user_groups/{userGroupId}/members",
}));
export const CreateUserGroupMemberResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const createUserGroupMember = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: CreateUserGroupMemberRequest,
    output: CreateUserGroupMemberResponse,
    errors: [InvalidMember],
}));
export const UpdateUserGroupMemberRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
    body: Schema.Array(Schema.Struct({
        id: Schema.String,
    })).pipe(T.HttpBody()),
}).pipe(T.Http({
    method: "PUT",
    path: "/accounts/{account_id}/iam/user_groups/{userGroupId}/members",
}));
export const UpdateUserGroupMemberResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    result: Schema.Array(Schema.Struct({
        id: Schema.String,
        email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
    })),
});
export const updateUserGroupMember = /*@__PURE__*/ /*#__PURE__*/ API.makePaginated(() => ({
    input: UpdateUserGroupMemberRequest,
    output: UpdateUserGroupMemberResponse,
    errors: [],
    pagination: {
        mode: "single",
        items: "result",
    },
}));
export const DeleteUserGroupMemberRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    userGroupId: Schema.String.pipe(T.HttpPath("userGroupId")),
    memberId: Schema.String.pipe(T.HttpPath("memberId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "DELETE",
    path: "/accounts/{account_id}/iam/user_groups/{userGroupId}/members/{memberId}",
}));
export const DeleteUserGroupMemberResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    id: Schema.String,
    email: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
    status: Schema.optional(Schema.Union([Schema.Literals(["accepted", "pending"]), Schema.Null])),
}).pipe(T.ResponsePath("result"));
export const deleteUserGroupMember = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: DeleteUserGroupMemberRequest,
    output: DeleteUserGroupMemberResponse,
    errors: [InvalidMember],
}));
export const BeginVerificationSsoRequest = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    ssoConnectorId: Schema.String.pipe(T.HttpPath("ssoConnectorId")),
    accountId: Schema.String.pipe(T.HttpPath("account_id")),
}).pipe(T.Http({
    method: "POST",
    path: "/accounts/{account_id}/sso_connectors/{ssoConnectorId}/begin_verification",
}));
export const BeginVerificationSsoResponse = 
/*@__PURE__*/ /*#__PURE__*/ Schema.Struct({
    errors: Schema.Array(Schema.Struct({
        code: Schema.Number,
        message: Schema.String,
        documentationUrl: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        source: Schema.optional(Schema.Union([
            Schema.Struct({
                pointer: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        code: "code",
        message: "message",
        documentationUrl: "documentation_url",
        source: "source",
    }))),
    messages: Schema.Array(Schema.Struct({
        code: Schema.Number,
        message: Schema.String,
        documentationUrl: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
        source: Schema.optional(Schema.Union([
            Schema.Struct({
                pointer: Schema.optional(Schema.Union([Schema.String, Schema.Null])),
            }),
            Schema.Null,
        ])),
    }).pipe(Schema.encodeKeys({
        code: "code",
        message: "message",
        documentationUrl: "documentation_url",
        source: "source",
    }))),
    success: Schema.Literal(true),
});
export const beginVerificationSso = /*@__PURE__*/ /*#__PURE__*/ API.make(() => ({
    input: BeginVerificationSsoRequest,
    output: BeginVerificationSsoResponse,
    errors: [],
}));
//# sourceMappingURL=iam.js.map