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

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

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

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

/** @internal */
export const GetSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest$outboundSchema:
  z.ZodType<
    GetSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest$Outbound,
    GetSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest
  > = 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 getSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequestToJSON(
  getSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest:
    GetSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest,
): string {
  return JSON.stringify(
    GetSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest$outboundSchema
      .parse(
        getSpanEvaluationFieldOptionsV1ObservabilitySpansEvaluationsFieldsFieldNameOptionsGetRequest,
      ),
  );
}
