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

import * as z from "zod/v3";
import { remap as remap$ } from "../lib/primitives.js";

export type RemoveRepositoryPermissionRequestBody = {
  /**
   * ID of a team that is granted access to a repository.
   */
  teamId?: string | undefined;
  /**
   * Slug of a team that is granted access to a repository.
   */
  teamSlug?: string | undefined;
};

export type RemoveRepositoryPermissionRequest = {
  /**
   * Project ID. Missing or empty values return HTTP 400.
   */
  projectId: string;
  idOrName: 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;
  requestBody?: RemoveRepositoryPermissionRequestBody | undefined;
};

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

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

export function removeRepositoryPermissionRequestBodyToJSON(
  removeRepositoryPermissionRequestBody: RemoveRepositoryPermissionRequestBody,
): string {
  return JSON.stringify(
    RemoveRepositoryPermissionRequestBody$outboundSchema.parse(
      removeRepositoryPermissionRequestBody,
    ),
  );
}

/** @internal */
export type RemoveRepositoryPermissionRequest$Outbound = {
  projectId: string;
  idOrName: string;
  teamId?: string | undefined;
  slug?: string | undefined;
  RequestBody?: RemoveRepositoryPermissionRequestBody$Outbound | undefined;
};

/** @internal */
export const RemoveRepositoryPermissionRequest$outboundSchema: z.ZodType<
  RemoveRepositoryPermissionRequest$Outbound,
  z.ZodTypeDef,
  RemoveRepositoryPermissionRequest
> = z.object({
  projectId: z.string(),
  idOrName: z.string(),
  teamId: z.string().optional(),
  slug: z.string().optional(),
  requestBody: z.lazy(() =>
    RemoveRepositoryPermissionRequestBody$outboundSchema
  ).optional(),
}).transform((v) => {
  return remap$(v, {
    requestBody: "RequestBody",
  });
});

export function removeRepositoryPermissionRequestToJSON(
  removeRepositoryPermissionRequest: RemoveRepositoryPermissionRequest,
): string {
  return JSON.stringify(
    RemoveRepositoryPermissionRequest$outboundSchema.parse(
      removeRepositoryPermissionRequest,
    ),
  );
}
