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

/**
 * - `-1`: N/A
 *
 * @remarks
 * - `0`: Over the air
 * - `1`: Cable
 * - `2`: Satellite
 * - `3`: IPTV
 * - `4`: Virtual
 */
export enum LineupType {
  Minus1 = -1,
  Zero = 0,
  One = 1,
  Two = 2,
  Three = 3,
  Four = 4,
}

export type Lineup = {
  title?: string | undefined;
  /**
   * The type of this object (`lineup` in this case)
   */
  type?: string | undefined;
  /**
   * - `-1`: N/A
   *
   * @remarks
   * - `0`: Over the air
   * - `1`: Cable
   * - `2`: Satellite
   * - `3`: IPTV
   * - `4`: Virtual
   */
  lineupType?: LineupType | undefined;
  location?: string | undefined;
  /**
   * The uuid of this lineup
   */
  uuid?: string | undefined;
};

/** @internal */
export const LineupType$inboundSchema: z.ZodNativeEnum<typeof LineupType> = z
  .nativeEnum(LineupType);

/** @internal */
export const Lineup$inboundSchema: z.ZodType<Lineup, z.ZodTypeDef, unknown> = z
  .object({
    title: z.string().optional(),
    type: z.string().optional(),
    lineupType: LineupType$inboundSchema.optional(),
    location: z.string().optional(),
    uuid: z.string().optional(),
  });

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