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

import * as z from "zod/v4";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";
import {
  ClientTasksRequestsCapability,
  ClientTasksRequestsCapability$inboundSchema,
} from "./clienttasksrequestscapability.js";

/**
 * Capability for client tasks operations.
 */
export type ClientTasksCapability = {
  list?: { [k: string]: any } | null | undefined;
  cancel?: { [k: string]: any } | null | undefined;
  requests?: ClientTasksRequestsCapability | null | undefined;
  [additionalProperties: string]: unknown;
};

/** @internal */
export const ClientTasksCapability$inboundSchema: z.ZodType<
  ClientTasksCapability,
  unknown
> = z.object({
  list: z.nullable(z.record(z.string(), z.any())).optional(),
  cancel: z.nullable(z.record(z.string(), z.any())).optional(),
  requests: z.nullable(ClientTasksRequestsCapability$inboundSchema).optional(),
}).catchall(z.any());

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