/*
 * 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 FlagConfigEvaluation = {
  contextKinds?: Array<string> | undefined;
};

/** @internal */
export const FlagConfigEvaluation$inboundSchema: z.ZodType<
  FlagConfigEvaluation,
  z.ZodTypeDef,
  unknown
> = z.object({
  contextKinds: z.array(z.string()).optional(),
});
/** @internal */
export type FlagConfigEvaluation$Outbound = {
  contextKinds?: Array<string> | undefined;
};

/** @internal */
export const FlagConfigEvaluation$outboundSchema: z.ZodType<
  FlagConfigEvaluation$Outbound,
  z.ZodTypeDef,
  FlagConfigEvaluation
> = z.object({
  contextKinds: z.array(z.string()).optional(),
});

export function flagConfigEvaluationToJSON(
  flagConfigEvaluation: FlagConfigEvaluation,
): string {
  return JSON.stringify(
    FlagConfigEvaluation$outboundSchema.parse(flagConfigEvaluation),
  );
}
export function flagConfigEvaluationFromJSON(
  jsonString: string,
): SafeParseResult<FlagConfigEvaluation, SDKValidationError> {
  return safeParse(
    jsonString,
    (x) => FlagConfigEvaluation$inboundSchema.parse(JSON.parse(x)),
    `Failed to parse 'FlagConfigEvaluation' from JSON`,
  );
}
