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

export type Channel = {
  title?: string | undefined;
  callSign?: string | undefined;
  channelVcn?: string | undefined;
  hd?: boolean | undefined;
  identifier?: string | undefined;
  key?: string | undefined;
  language?: string | undefined;
  thumb?: string | undefined;
};

/** @internal */
export const Channel$inboundSchema: z.ZodType<Channel, z.ZodTypeDef, unknown> =
  z.object({
    title: z.string().optional(),
    callSign: z.string().optional(),
    channelVcn: z.string().optional(),
    hd: z.boolean().optional(),
    identifier: z.string().optional(),
    key: z.string().optional(),
    language: z.string().optional(),
    thumb: z.string().optional(),
  });

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