/*
 * 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 { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import * as types from "../../types/primitives.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type CreateWorkspaceDocumentOwner = {
  userId?: string | null | undefined;
  firstName?: string | null | undefined;
  lastName?: string | null | undefined;
};

/** @internal */
export const CreateWorkspaceDocumentOwner$inboundSchema: z.ZodType<
  CreateWorkspaceDocumentOwner,
  z.ZodTypeDef,
  unknown
> = z.object({
  user_id: z.nullable(types.string()).optional(),
  first_name: z.nullable(types.string()).optional(),
  last_name: z.nullable(types.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "user_id": "userId",
    "first_name": "firstName",
    "last_name": "lastName",
  });
});

export function createWorkspaceDocumentOwnerFromJSON(
  jsonString: string,
): SafeParseResult<CreateWorkspaceDocumentOwner, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CreateWorkspaceDocumentOwner$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CreateWorkspaceDocumentOwner' from JSON`,
  );
}
