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

import * as z from "zod/v3";
import { safeParse } from "../../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  TranscriptItemSpeaker,
  TranscriptItemSpeaker$inboundSchema,
} from "./transcriptitemspeaker.js";

export type TranscriptItem = {
  speaker: TranscriptItemSpeaker;
  text: string;
  /**
   * Timestamp relative to the start of the meeting (HH:MM:SS).
   */
  timestamp: string;
};

/** @internal */
export const TranscriptItem$inboundSchema: z.ZodType<
  TranscriptItem,
  z.ZodTypeDef,
  unknown
> = z.object({
  speaker: TranscriptItemSpeaker$inboundSchema,
  text: z.string(),
  timestamp: z.string(),
});

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