/*
 * 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 GetExperimentRequest = {
  /**
   * The project key
   */
  projectKey: string;
  /**
   * The environment key
   */
  environmentKey: string;
  /**
   * The experiment key
   */
  experimentKey: string;
  /**
   * A comma-separated list of properties that can reveal additional information in the response. Supported fields are explained above.
   */
  expand?: string | undefined;
};

/** @internal */
export const GetExperimentRequest$inboundSchema: z.ZodType<
  GetExperimentRequest,
  z.ZodTypeDef,
  unknown
> = z.object({
  projectKey: z.string(),
  environmentKey: z.string(),
  experimentKey: z.string(),
  expand: z.string().optional(),
});
/** @internal */
export type GetExperimentRequest$Outbound = {
  projectKey: string;
  environmentKey: string;
  experimentKey: string;
  expand?: string | undefined;
};

/** @internal */
export const GetExperimentRequest$outboundSchema: z.ZodType<
  GetExperimentRequest$Outbound,
  z.ZodTypeDef,
  GetExperimentRequest
> = z.object({
  projectKey: z.string(),
  environmentKey: z.string(),
  experimentKey: z.string(),
  expand: z.string().optional(),
});

export function getExperimentRequestToJSON(
  getExperimentRequest: GetExperimentRequest,
): string {
  return JSON.stringify(
    GetExperimentRequest$outboundSchema.parse(getExperimentRequest),
  );
}
export function getExperimentRequestFromJSON(
  jsonString: string,
): SafeParseResult<GetExperimentRequest, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => GetExperimentRequest$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'GetExperimentRequest' from JSON`,
  );
}
