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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type ScheduleRange = {
  start: number;
  end?: number | undefined;
  step?: number | undefined;
};

/** @internal */
export const ScheduleRange$inboundSchema: z.ZodType<ScheduleRange, unknown> = z
  .object({
    start: z.int(),
    end: z.int().default(0),
    step: z.int().default(0),
  });
/** @internal */
export type ScheduleRange$Outbound = {
  start: number;
  end: number;
  step: number;
};

/** @internal */
export const ScheduleRange$outboundSchema: z.ZodType<
  ScheduleRange$Outbound,
  ScheduleRange
> = z.object({
  start: z.int(),
  end: z.int().default(0),
  step: z.int().default(0),
});

export function scheduleRangeToJSON(scheduleRange: ScheduleRange): string {
  return JSON.stringify(ScheduleRange$outboundSchema.parse(scheduleRange));
}
export function scheduleRangeFromJSON(
  jsonString: string,
): SafeParseResult<ScheduleRange, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => ScheduleRange$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'ScheduleRange' from JSON`,
  );
}
