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

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

export type WorkspaceUserForCreate = {
  /**
   * The email address of the added user. May be an internal user to the account or an external user
   */
  email: string;
  /**
   * The first name of the added user
   */
  firstName: string;
  /**
   * The last name of the added user
   */
  lastName: string;
  /**
   * The optional Role ID to assign to the user. Defaults to the "Participate" role
   */
  roleId?: string | null | undefined;
};

/** @internal */
export type WorkspaceUserForCreate$Outbound = {
  email: string;
  first_name: string;
  last_name: string;
  role_id?: string | null | undefined;
};

/** @internal */
export const WorkspaceUserForCreate$outboundSchema: z.ZodType<
  WorkspaceUserForCreate$Outbound,
  z.ZodTypeDef,
  WorkspaceUserForCreate
> = z.object({
  email: z.string(),
  firstName: z.string(),
  lastName: z.string(),
  roleId: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    firstName: "first_name",
    lastName: "last_name",
    roleId: "role_id",
  });
});

export function workspaceUserForCreateToJSON(
  workspaceUserForCreate: WorkspaceUserForCreate,
): string {
  return JSON.stringify(
    WorkspaceUserForCreate$outboundSchema.parse(workspaceUserForCreate),
  );
}
