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

/**
 * Schema to attach a custom field to a resource.
 */
export type AttachedCustomFieldCreate = {
  /**
   * ID of the custom field to attach.
   */
  customFieldId: string;
  /**
   * Whether the value is required for this custom field.
   */
  required: boolean;
};

/** @internal */
export type AttachedCustomFieldCreate$Outbound = {
  custom_field_id: string;
  required: boolean;
};

/** @internal */
export const AttachedCustomFieldCreate$outboundSchema: z.ZodMiniType<
  AttachedCustomFieldCreate$Outbound,
  AttachedCustomFieldCreate
> = z.pipe(
  z.object({
    customFieldId: z.string(),
    required: z.boolean(),
  }),
  z.transform((v) => {
    return remap$(v, {
      customFieldId: "custom_field_id",
    });
  }),
);

export function attachedCustomFieldCreateToJSON(
  attachedCustomFieldCreate: AttachedCustomFieldCreate,
): string {
  return JSON.stringify(
    AttachedCustomFieldCreate$outboundSchema.parse(attachedCustomFieldCreate),
  );
}
