/*
 * 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 * as types from "../types/primitives.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

export type DeleteAllArtifactsRequest = {
  /**
   * 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;
};

/**
 * Success. All cache artifacts for the account were deleted.
 */
export type DeleteAllArtifactsResponseBody = {
  deletedCount: number;
};

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

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

export function deleteAllArtifactsRequestToJSON(
  deleteAllArtifactsRequest: DeleteAllArtifactsRequest,
): string {
  return JSON.stringify(
    DeleteAllArtifactsRequest$outboundSchema.parse(deleteAllArtifactsRequest),
  );
}

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

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