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

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

export type SearchTracesV1ObservabilityTracesSearchPostRequest = {
  from?: Date | null | undefined;
  to?: Date | null | undefined;
  pageSize?: number | undefined;
  cursor?: string | null | undefined;
  tracesRequest: components.TracesRequest;
};

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

/** @internal */
export const SearchTracesV1ObservabilityTracesSearchPostRequest$outboundSchema:
  z.ZodType<
    SearchTracesV1ObservabilityTracesSearchPostRequest$Outbound,
    SearchTracesV1ObservabilityTracesSearchPostRequest
  > = 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(),
    tracesRequest: components.TracesRequest$outboundSchema,
  }).transform((v) => {
    return remap$(v, {
      pageSize: "page_size",
      tracesRequest: "TracesRequest",
    });
  });

export function searchTracesV1ObservabilityTracesSearchPostRequestToJSON(
  searchTracesV1ObservabilityTracesSearchPostRequest:
    SearchTracesV1ObservabilityTracesSearchPostRequest,
): string {
  return JSON.stringify(
    SearchTracesV1ObservabilityTracesSearchPostRequest$outboundSchema.parse(
      searchTracesV1ObservabilityTracesSearchPostRequest,
    ),
  );
}
