/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */

import * as z from "zod/v3";
import { remap as remap$ } from "../../lib/primitives.js";
import * as components from "../components/index.js";

export type UpdateWorkspaceUserRequest = {
  /**
   * The ID of the account
   */
  accountId: string;
  /**
   * The ID of the workspace
   */
  workspaceId: string;
  /**
   * The ID of the user to update
   */
  userId: string;
  /**
   * The user details to update to including the RoleId
   */
  workspaceUserForUpdate?: components.WorkspaceUserForUpdate | undefined;
};

/** @internal */
export type UpdateWorkspaceUserRequest$Outbound = {
  accountId: string;
  workspaceId: string;
  userId: string;
  WorkspaceUserForUpdate?:
    | components.WorkspaceUserForUpdate$Outbound
    | undefined;
};

/** @internal */
export const UpdateWorkspaceUserRequest$outboundSchema: z.ZodType<
  UpdateWorkspaceUserRequest$Outbound,
  z.ZodTypeDef,
  UpdateWorkspaceUserRequest
> = z.object({
  accountId: z.string(),
  workspaceId: z.string(),
  userId: z.string(),
  workspaceUserForUpdate: components.WorkspaceUserForUpdate$outboundSchema
    .optional(),
}).transform((v) => {
  return remap$(v, {
    workspaceUserForUpdate: "WorkspaceUserForUpdate",
  });
});

export function updateWorkspaceUserRequestToJSON(
  updateWorkspaceUserRequest: UpdateWorkspaceUserRequest,
): string {
  return JSON.stringify(
    UpdateWorkspaceUserRequest$outboundSchema.parse(updateWorkspaceUserRequest),
  );
}
