/*
 * 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";

/**
 * The transcode session if item is currently being transcoded
 */
export type TranscodeSession = {
  complete?: boolean | undefined;
  context?: string | undefined;
  duration?: number | undefined;
  error?: boolean | undefined;
  key?: string | undefined;
  progress?: number | undefined;
  protocol?: string | undefined;
  size?: number | undefined;
  sourceAudioCodec?: string | undefined;
  sourceVideoCodec?: string | undefined;
  speed?: number | undefined;
  throttled?: boolean | undefined;
  transcodeHwFullPipeline?: boolean | undefined;
  transcodeHwRequested?: boolean | undefined;
};

/** @internal */
export const TranscodeSession$inboundSchema: z.ZodType<
  TranscodeSession,
  z.ZodTypeDef,
  unknown
> = z.object({
  complete: z.boolean().optional(),
  context: z.string().optional(),
  duration: z.number().int().optional(),
  error: z.boolean().optional(),
  key: z.string().optional(),
  progress: z.number().optional(),
  protocol: z.string().optional(),
  size: z.number().int().optional(),
  sourceAudioCodec: z.string().optional(),
  sourceVideoCodec: z.string().optional(),
  speed: z.number().optional(),
  throttled: z.boolean().optional(),
  transcodeHwFullPipeline: z.boolean().optional(),
  transcodeHwRequested: z.boolean().optional(),
});

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