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

import * as z from "zod/v3";
import { safeParse } from "../../lib/schemas.js";
import { Result as SafeParseResult } from "../../types/fp.js";
import { SDKValidationError } from "../errors/sdkvalidationerror.js";

export type TreatmentParameterInput = {
  /**
   * The flag key
   */
  flagKey: string;
  /**
   * The ID of the flag variation
   */
  variationId: string;
};

/** @internal */
export const TreatmentParameterInput$inboundSchema: z.ZodType<
  TreatmentParameterInput,
  z.ZodTypeDef,
  unknown
> = z.object({
  flagKey: z.string(),
  variationId: z.string(),
});
/** @internal */
export type TreatmentParameterInput$Outbound = {
  flagKey: string;
  variationId: string;
};

/** @internal */
export const TreatmentParameterInput$outboundSchema: z.ZodType<
  TreatmentParameterInput$Outbound,
  z.ZodTypeDef,
  TreatmentParameterInput
> = z.object({
  flagKey: z.string(),
  variationId: z.string(),
});

export function treatmentParameterInputToJSON(
  treatmentParameterInput: TreatmentParameterInput,
): string {
  return JSON.stringify(
    TreatmentParameterInput$outboundSchema.parse(treatmentParameterInput),
  );
}
export function treatmentParameterInputFromJSON(
  jsonString: string,
): SafeParseResult<TreatmentParameterInput, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => TreatmentParameterInput$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'TreatmentParameterInput' from JSON`,
  );
}
