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

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

export type SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest =
  {
    from?: Date | null | undefined;
    to?: Date | null | undefined;
    pageSize?: number | undefined;
    cursor?: string | null | undefined;
    spanEvaluationsRequest: components.SpanEvaluationsRequest;
  };

/** @internal */
export type SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest$Outbound =
  {
    from?: string | null | undefined;
    to?: string | null | undefined;
    page_size: number;
    cursor?: string | null | undefined;
    SpanEvaluationsRequest: components.SpanEvaluationsRequest$Outbound;
  };

/** @internal */
export const SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest$outboundSchema:
  z.ZodType<
    SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest$Outbound,
    SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest
  > = z.object({
    from: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    to: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    pageSize: z.int().default(50),
    cursor: z.nullable(z.string()).optional(),
    spanEvaluationsRequest: components.SpanEvaluationsRequest$outboundSchema,
  }).transform((v) => {
    return remap$(v, {
      pageSize: "page_size",
      spanEvaluationsRequest: "SpanEvaluationsRequest",
    });
  });

export function searchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequestToJSON(
  searchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest:
    SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest,
): string {
  return JSON.stringify(
    SearchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest$outboundSchema
      .parse(
        searchLatestSpanEvaluationsV1ObservabilitySpansEvaluationsSearchLatestPostRequest,
      ),
  );
}
