/*
 * 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 WorkspaceDocumentOwner = {
  /**
   * The first name of the document owner
   */
  firstName?: string | null | undefined;
  /**
   * The last name of the document owner
   */
  lastName?: string | null | undefined;
};

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

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