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

import * as z from "zod/v4";
import { remap as remap$ } from "../../lib/primitives.js";
import { EntityType, EntityType$outboundSchema } from "./entitytype.js";
import { ShareEnum, ShareEnum$outboundSchema } from "./shareenum.js";

export type SharingRequest = {
  /**
   * @deprecated field: This will be removed in a future release, please migrate away from it as soon as possible.
   */
  orgId?: string | null | undefined;
  level: ShareEnum;
  /**
   * The id of the entity (user, workspace or organization) to share with
   */
  shareWithUuid: string;
  /**
   * The type of entity, used to share a library.
   */
  shareWithType: EntityType;
};

/** @internal */
export type SharingRequest$Outbound = {
  org_id?: string | null | undefined;
  level: string;
  share_with_uuid: string;
  share_with_type: string;
};

/** @internal */
export const SharingRequest$outboundSchema: z.ZodType<
  SharingRequest$Outbound,
  SharingRequest
> = z.object({
  orgId: z.nullable(z.string()).optional(),
  level: ShareEnum$outboundSchema,
  shareWithUuid: z.string(),
  shareWithType: EntityType$outboundSchema,
}).transform((v) => {
  return remap$(v, {
    orgId: "org_id",
    shareWithUuid: "share_with_uuid",
    shareWithType: "share_with_type",
  });
});

export function sharingRequestToJSON(sharingRequest: SharingRequest): string {
  return JSON.stringify(SharingRequest$outboundSchema.parse(sharingRequest));
}
