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

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

export type SearchLogsV1ObservabilityLogsSearchPostRequest = {
  from?: Date | null | undefined;
  to?: Date | null | undefined;
  pageSize?: number | undefined;
  cursor?: string | null | undefined;
  logsRequest: components.LogsRequest;
};

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

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

export function searchLogsV1ObservabilityLogsSearchPostRequestToJSON(
  searchLogsV1ObservabilityLogsSearchPostRequest:
    SearchLogsV1ObservabilityLogsSearchPostRequest,
): string {
  return JSON.stringify(
    SearchLogsV1ObservabilityLogsSearchPostRequest$outboundSchema.parse(
      searchLogsV1ObservabilityLogsSearchPostRequest,
    ),
  );
}
