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

import * as z from "zod/v4-mini";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type BenefitGrantSlackSharedChannelProperties = {
  invitedEmail?: string | undefined;
  channelId?: string | undefined;
  channelName?: string | undefined;
  inviteId?: string | undefined;
  inviteUrl?: string | undefined;
  connectedTeamId?: string | undefined;
};

/** @internal */
export const BenefitGrantSlackSharedChannelProperties$inboundSchema:
  z.ZodMiniType<BenefitGrantSlackSharedChannelProperties, unknown> = z.pipe(
    z.object({
      invited_email: z.optional(z.string()),
      channel_id: z.optional(z.string()),
      channel_name: z.optional(z.string()),
      invite_id: z.optional(z.string()),
      invite_url: z.optional(z.string()),
      connected_team_id: z.optional(z.string()),
    }),
    z.transform((v) => {
      return remap$(v, {
        "invited_email": "invitedEmail",
        "channel_id": "channelId",
        "channel_name": "channelName",
        "invite_id": "inviteId",
        "invite_url": "inviteUrl",
        "connected_team_id": "connectedTeamId",
      });
    }),
  );
/** @internal */
export type BenefitGrantSlackSharedChannelProperties$Outbound = {
  invited_email?: string | undefined;
  channel_id?: string | undefined;
  channel_name?: string | undefined;
  invite_id?: string | undefined;
  invite_url?: string | undefined;
  connected_team_id?: string | undefined;
};

/** @internal */
export const BenefitGrantSlackSharedChannelProperties$outboundSchema:
  z.ZodMiniType<
    BenefitGrantSlackSharedChannelProperties$Outbound,
    BenefitGrantSlackSharedChannelProperties
  > = z.pipe(
    z.object({
      invitedEmail: z.optional(z.string()),
      channelId: z.optional(z.string()),
      channelName: z.optional(z.string()),
      inviteId: z.optional(z.string()),
      inviteUrl: z.optional(z.string()),
      connectedTeamId: z.optional(z.string()),
    }),
    z.transform((v) => {
      return remap$(v, {
        invitedEmail: "invited_email",
        channelId: "channel_id",
        channelName: "channel_name",
        inviteId: "invite_id",
        inviteUrl: "invite_url",
        connectedTeamId: "connected_team_id",
      });
    }),
  );

export function benefitGrantSlackSharedChannelPropertiesToJSON(
  benefitGrantSlackSharedChannelProperties:
    BenefitGrantSlackSharedChannelProperties,
): string {
  return JSON.stringify(
    BenefitGrantSlackSharedChannelProperties$outboundSchema.parse(
      benefitGrantSlackSharedChannelProperties,
    ),
  );
}
export function benefitGrantSlackSharedChannelPropertiesFromJSON(
  jsonString: string,
): SafeParseResult<
  BenefitGrantSlackSharedChannelProperties,
  SDKValidationError
> {
  return safeParse(
    jsonString,
    (x) =>
      BenefitGrantSlackSharedChannelProperties$inboundSchema.parse(
        JSON.parse(x),
      ),
    `Failed to parse 'BenefitGrantSlackSharedChannelProperties' from JSON`,
  );
}
