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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  ScheduleDefinitionOutput,
  ScheduleDefinitionOutput$inboundSchema,
} from "./scheduledefinitionoutput.js";

export type WorkflowScheduleListResponse = {
  /**
   * A list of workflow schedules
   */
  schedules: Array<ScheduleDefinitionOutput>;
  /**
   * Token for the next page of results
   */
  nextPageToken?: string | null | undefined;
};

/** @internal */
export const WorkflowScheduleListResponse$inboundSchema: z.ZodType<
  WorkflowScheduleListResponse,
  unknown
> = z.object({
  schedules: z.array(ScheduleDefinitionOutput$inboundSchema),
  next_page_token: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "next_page_token": "nextPageToken",
  });
});

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