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

import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";
import { safeParse } from "../lib/schemas.js";
import { Result as SafeParseResult } from "../types/fp.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

export type WriteSessionFilesRequest = {
  /**
   * The target directory where the tarball contents will be extracted. If not specified, files are extracted to the sandbox home directory.
   */
  xCwd?: string | undefined;
  /**
   * The unique identifier of the session to write files to.
   */
  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;
};

/**
 * The files were successfully written to the session.
 */
export type WriteSessionFilesResponseBody = {};

/** @internal */
export type WriteSessionFilesRequest$Outbound = {
  "x-cwd"?: string | undefined;
  sessionId: string;
  teamId?: string | undefined;
  slug?: string | undefined;
};

/** @internal */
export const WriteSessionFilesRequest$outboundSchema: z.ZodType<
  WriteSessionFilesRequest$Outbound,
  z.ZodTypeDef,
  WriteSessionFilesRequest
> = z.object({
  xCwd: z.string().optional(),
  sessionId: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
}).transform((v) => {
  return remap$(v, {
    xCwd: "x-cwd",
  });
});

export function writeSessionFilesRequestToJSON(
  writeSessionFilesRequest: WriteSessionFilesRequest,
): string {
  return JSON.stringify(
    WriteSessionFilesRequest$outboundSchema.parse(writeSessionFilesRequest),
  );
}

/** @internal */
export const WriteSessionFilesResponseBody$inboundSchema: z.ZodType<
  WriteSessionFilesResponseBody,
  z.ZodTypeDef,
  unknown
> = z.object({});

export function writeSessionFilesResponseBodyFromJSON(
  jsonString: string,
): SafeParseResult<WriteSessionFilesResponseBody, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => WriteSessionFilesResponseBody$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'WriteSessionFilesResponseBody' from JSON`,
  );
}
