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

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

export type ScheduleFutureExecution = {
  /**
   * Time the execution is scheduled to run.
   */
  scheduledAt: Date;
};

/** @internal */
export const ScheduleFutureExecution$inboundSchema: z.ZodType<
  ScheduleFutureExecution,
  unknown
> = z.object({
  scheduled_at: z.iso.datetime({ offset: true }).transform(v => new Date(v)),
}).transform((v) => {
  return remap$(v, {
    "scheduled_at": "scheduledAt",
  });
});

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