/*
 * 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 { Drive, Drive$inboundSchema } from "./drive.js";
import { SDKValidationError } from "./sdkvalidationerror.js";

export type DeleteDriveRequest = {
  /**
   * Name for the drive. Must be unique per project and URL-safe (alphanumeric, hyphens, underscores).
   */
  name: string;
  /**
   * The project ID or name associated with the drive. Required unless using a Vercel OIDC token scoped to a project.
   */
  projectId?: string | undefined;
  /**
   * 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;
};

export type DeleteDriveResponseBody = {
  /**
   * This object contains information related to a Vercel Sandbox Drive.
   */
  drive: Drive;
};

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

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

export function deleteDriveRequestToJSON(
  deleteDriveRequest: DeleteDriveRequest,
): string {
  return JSON.stringify(
    DeleteDriveRequest$outboundSchema.parse(deleteDriveRequest),
  );
}

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

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