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

import * as z from "zod";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import {
  List,
  List$inboundSchema,
  List$Outbound,
  List$outboundSchema,
} from "../components/list.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type GetV2ListsListRequest = {
  list: string;
};

/**
 * Success
 */
export type GetV2ListsListResponse = {
  data: List;
};

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

/** @internal */
export type GetV2ListsListRequest$Outbound = {
  list: string;
};

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

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetV2ListsListRequest$ {
  /** @deprecated use `GetV2ListsListRequest$inboundSchema` instead. */
  export const inboundSchema = GetV2ListsListRequest$inboundSchema;
  /** @deprecated use `GetV2ListsListRequest$outboundSchema` instead. */
  export const outboundSchema = GetV2ListsListRequest$outboundSchema;
  /** @deprecated use `GetV2ListsListRequest$Outbound` instead. */
  export type Outbound = GetV2ListsListRequest$Outbound;
}

export function getV2ListsListRequestToJSON(
  getV2ListsListRequest: GetV2ListsListRequest,
): string {
  return JSON.stringify(
    GetV2ListsListRequest$outboundSchema.parse(getV2ListsListRequest),
  );
}

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

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

/** @internal */
export type GetV2ListsListResponse$Outbound = {
  data: List$Outbound;
};

/** @internal */
export const GetV2ListsListResponse$outboundSchema: z.ZodType<
  GetV2ListsListResponse$Outbound,
  z.ZodTypeDef,
  GetV2ListsListResponse
> = z.object({
  data: List$outboundSchema,
});

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetV2ListsListResponse$ {
  /** @deprecated use `GetV2ListsListResponse$inboundSchema` instead. */
  export const inboundSchema = GetV2ListsListResponse$inboundSchema;
  /** @deprecated use `GetV2ListsListResponse$outboundSchema` instead. */
  export const outboundSchema = GetV2ListsListResponse$outboundSchema;
  /** @deprecated use `GetV2ListsListResponse$Outbound` instead. */
  export type Outbound = GetV2ListsListResponse$Outbound;
}

export function getV2ListsListResponseToJSON(
  getV2ListsListResponse: GetV2ListsListResponse,
): string {
  return JSON.stringify(
    GetV2ListsListResponse$outboundSchema.parse(getV2ListsListResponse),
  );
}

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