/*
 * 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";

/**
 * Properties available to subscribers for a benefit of type `discord`.
 */
export type BenefitDiscordSubscriberProperties = {
  /**
   * The ID of the Discord server.
   */
  guildId: string;
};

/** @internal */
export const BenefitDiscordSubscriberProperties$inboundSchema: z.ZodMiniType<
  BenefitDiscordSubscriberProperties,
  unknown
> = z.pipe(
  z.object({
    guild_id: z.string(),
  }),
  z.transform((v) => {
    return remap$(v, {
      "guild_id": "guildId",
    });
  }),
);

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