/*
 * 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 CustomFieldDateProperties = {
  formLabel?: string | undefined;
  formHelpText?: string | undefined;
  formPlaceholder?: string | undefined;
  ge?: number | undefined;
  le?: number | undefined;
};

/** @internal */
export const CustomFieldDateProperties$inboundSchema: z.ZodMiniType<
  CustomFieldDateProperties,
  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 CustomFieldDateProperties$Outbound = {
  form_label?: string | undefined;
  form_help_text?: string | undefined;
  form_placeholder?: string | undefined;
  ge?: number | undefined;
  le?: number | undefined;
};

/** @internal */
export const CustomFieldDateProperties$outboundSchema: z.ZodMiniType<
  CustomFieldDateProperties$Outbound,
  CustomFieldDateProperties
> = 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 customFieldDatePropertiesToJSON(
  customFieldDateProperties: CustomFieldDateProperties,
): string {
  return JSON.stringify(
    CustomFieldDateProperties$outboundSchema.parse(customFieldDateProperties),
  );
}
export function customFieldDatePropertiesFromJSON(
  jsonString: string,
): SafeParseResult<CustomFieldDateProperties, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => CustomFieldDateProperties$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'CustomFieldDateProperties' from JSON`,
  );
}
