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

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

export type ListSessionCommandsRequest = {
  /**
   * The unique identifier of the session to list commands for.
   */
  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 list of commands executed in the session.
 */
export type ListSessionCommandsResponseBody = {
  commands: Array<SessionCommand>;
};

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

/** @internal */
export const ListSessionCommandsRequest$outboundSchema: z.ZodType<
  ListSessionCommandsRequest$Outbound,
  z.ZodTypeDef,
  ListSessionCommandsRequest
> = z.object({
  sessionId: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
});

export function listSessionCommandsRequestToJSON(
  listSessionCommandsRequest: ListSessionCommandsRequest,
): string {
  return JSON.stringify(
    ListSessionCommandsRequest$outboundSchema.parse(listSessionCommandsRequest),
  );
}

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

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