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

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

export const TriggeredFor = {
  MyRecordings: "my_recordings",
  SharedExternalRecordings: "shared_external_recordings",
  MySharedWithTeamRecordings: "my_shared_with_team_recordings",
  SharedTeamRecordings: "shared_team_recordings",
} as const;
export type TriggeredFor = ClosedEnum<typeof TriggeredFor>;

export type CreateWebhookRequest = {
  /**
   * The URL to send the webhook to.
   */
  destinationUrl: string;
  /**
   * Include the action items for each meeting.
   */
  includeActionItems?: boolean | undefined;
  /**
   * Include CRM matches for each meeting. Only returns data from your or your team's linked CRM.
   */
  includeCrmMatches?: boolean | undefined;
  /**
   * Include the summary for each meeting.
   */
  includeSummary?: boolean | undefined;
  /**
   * Include the transcript for each meeting.
   */
  includeTranscript?: boolean | undefined;
  /**
   * You must send at least one of the following types of recordings to trigger on.
   *
   * @remarks
   * - `my_recordings`: Your private recordings, as well as those you've shared with individuals. (On Team Plans, this excludes recordings you've shared with any teams.)
   * - `shared_external_recordings`: Recordings shared with you by other users. (For Team Plans, this does not include recordings shared by other users on your Team Plan.)
   * - `my_shared_with_team_recordings`: (Team Plans only). All recordings that you have shared with other teams (e.g. Marketing or Sales). Recordings you've shared with individuals but not with teams are not included.
   * - `shared_team_recordings`: (Team Plans only) All recordings you can access from other users on your Team Plan, whether shared with you individually or with your team.
   */
  triggeredFor: Array<TriggeredFor>;
};

/** @internal */
export const TriggeredFor$outboundSchema: z.ZodNativeEnum<typeof TriggeredFor> =
  z.nativeEnum(TriggeredFor);

/** @internal */
export type CreateWebhookRequest$Outbound = {
  destination_url: string;
  include_action_items: boolean;
  include_crm_matches: boolean;
  include_summary: boolean;
  include_transcript: boolean;
  triggered_for: Array<string>;
};

/** @internal */
export const CreateWebhookRequest$outboundSchema: z.ZodType<
  CreateWebhookRequest$Outbound,
  z.ZodTypeDef,
  CreateWebhookRequest
> = z.object({
  destinationUrl: z.string(),
  includeActionItems: z.boolean().default(false),
  includeCrmMatches: z.boolean().default(false),
  includeSummary: z.boolean().default(false),
  includeTranscript: z.boolean().default(false),
  triggeredFor: z.array(TriggeredFor$outboundSchema),
}).transform((v) => {
  return remap$(v, {
    destinationUrl: "destination_url",
    includeActionItems: "include_action_items",
    includeCrmMatches: "include_crm_matches",
    includeSummary: "include_summary",
    includeTranscript: "include_transcript",
    triggeredFor: "triggered_for",
  });
});

export function createWebhookRequestToJSON(
  createWebhookRequest: CreateWebhookRequest,
): string {
  return JSON.stringify(
    CreateWebhookRequest$outboundSchema.parse(createWebhookRequest),
  );
}
