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

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 SignalDefinition = {
  /**
   * Name of the signal
   */
  name: string;
  /**
   * Description of the signal
   */
  description?: string | null | undefined;
  /**
   * Input JSON schema of the signal's model
   */
  inputSchema: { [k: string]: any };
};

/** @internal */
export const SignalDefinition$inboundSchema: z.ZodType<
  SignalDefinition,
  unknown
> = z.object({
  name: z.string(),
  description: z.nullable(z.string()).optional(),
  input_schema: z.record(z.string(), z.any()),
}).transform((v) => {
  return remap$(v, {
    "input_schema": "inputSchema",
  });
});

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