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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";

export type GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest =
  {
    fieldName: string;
    from?: Date | null | undefined;
    to?: Date | null | undefined;
  };

/** @internal */
export type GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest$Outbound =
  {
    field_name: string;
    from?: string | null | undefined;
    to?: string | null | undefined;
  };

/** @internal */
export const GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest$outboundSchema:
  z.ZodType<
    GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest$Outbound,
    GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest
  > = z.object({
    fieldName: z.string(),
    from: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    to: z.nullable(z.date().transform(v => v.toISOString())).optional(),
  }).transform((v) => {
    return remap$(v, {
      fieldName: "field_name",
    });
  });

export function getSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequestToJSON(
  getSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest:
    GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest,
): string {
  return JSON.stringify(
    GetSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest$outboundSchema
      .parse(
        getSpanFieldOptionsV1ObservabilitySpansFieldsFieldNameOptionsGetRequest,
      ),
  );
}
