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

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

export type ReadSessionFileRequestBody = {
  /**
   * The base directory for resolving relative paths. If not specified, paths are resolved from the sandbox home directory.
   */
  cwd?: string | undefined;
  /**
   * The path of the file to read. Can be absolute or relative to the working directory.
   */
  path: string;
};

export type ReadSessionFileRequest = {
  /**
   * The unique identifier of the session to read the file from.
   */
  sessionId: string;
  /**
   * The Team identifier to perform the request on behalf of.
   */
  teamId?: string | undefined;
  /**
   * The Team slug to perform the request on behalf of.
   */
  slug?: string | undefined;
  requestBody?: ReadSessionFileRequestBody | undefined;
};

/** @internal */
export type ReadSessionFileRequestBody$Outbound = {
  cwd?: string | undefined;
  path: string;
};

/** @internal */
export const ReadSessionFileRequestBody$outboundSchema: z.ZodType<
  ReadSessionFileRequestBody$Outbound,
  z.ZodTypeDef,
  ReadSessionFileRequestBody
> = z.object({
  cwd: z.string().optional(),
  path: z.string(),
});

export function readSessionFileRequestBodyToJSON(
  readSessionFileRequestBody: ReadSessionFileRequestBody,
): string {
  return JSON.stringify(
    ReadSessionFileRequestBody$outboundSchema.parse(readSessionFileRequestBody),
  );
}

/** @internal */
export type ReadSessionFileRequest$Outbound = {
  sessionId: string;
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody?: ReadSessionFileRequestBody$Outbound | undefined;
};

/** @internal */
export const ReadSessionFileRequest$outboundSchema: z.ZodType<
  ReadSessionFileRequest$Outbound,
  z.ZodTypeDef,
  ReadSessionFileRequest
> = z.object({
  sessionId: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: z.lazy(() => ReadSessionFileRequestBody$outboundSchema)
    .optional(),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function readSessionFileRequestToJSON(
  readSessionFileRequest: ReadSessionFileRequest,
): string {
  return JSON.stringify(
    ReadSessionFileRequest$outboundSchema.parse(readSessionFileRequest),
  );
}
