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

import * as z from "zod/v4-mini";
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 CustomFieldNumberProperties = {
  formLabel?: string | undefined;
  formHelpText?: string | undefined;
  formPlaceholder?: string | undefined;
  ge?: number | undefined;
  le?: number | undefined;
};

/** @internal */
export const CustomFieldNumberProperties$inboundSchema: z.ZodMiniType<
  CustomFieldNumberProperties,
  unknown
> = z.pipe(
  z.object({
    form_label: z.optional(z.string()),
    form_help_text: z.optional(z.string()),
    form_placeholder: z.optional(z.string()),
    ge: z.optional(z.int()),
    le: z.optional(z.int()),
  }),
  z.transform((v) => {
    return remap$(v, {
      "form_label": "formLabel",
      "form_help_text": "formHelpText",
      "form_placeholder": "formPlaceholder",
    });
  }),
);
/** @internal */
export type CustomFieldNumberProperties$Outbound = {
  form_label?: string | undefined;
  form_help_text?: string | undefined;
  form_placeholder?: string | undefined;
  ge?: number | undefined;
  le?: number | undefined;
};

/** @internal */
export const CustomFieldNumberProperties$outboundSchema: z.ZodMiniType<
  CustomFieldNumberProperties$Outbound,
  CustomFieldNumberProperties
> = z.pipe(
  z.object({
    formLabel: z.optional(z.string()),
    formHelpText: z.optional(z.string()),
    formPlaceholder: z.optional(z.string()),
    ge: z.optional(z.int()),
    le: z.optional(z.int()),
  }),
  z.transform((v) => {
    return remap$(v, {
      formLabel: "form_label",
      formHelpText: "form_help_text",
      formPlaceholder: "form_placeholder",
    });
  }),
);

export function customFieldNumberPropertiesToJSON(
  customFieldNumberProperties: CustomFieldNumberProperties,
): string {
  return JSON.stringify(
    CustomFieldNumberProperties$outboundSchema.parse(
      customFieldNumberProperties,
    ),
  );
}
export function customFieldNumberPropertiesFromJSON(
  jsonString: string,
): SafeParseResult<CustomFieldNumberProperties, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomFieldNumberProperties$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomFieldNumberProperties' from JSON`,
  );
}
