/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 07837c0b7ced
 */

import * as z from "zod/v4";
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";
import { LocationType, LocationType$inboundSchema } from "./locationtype.js";

export type DeploymentLocation = {
  locationType: LocationType;
  /**
   * K8s cluster name, if applicable
   */
  k8sCluster?: string | null | undefined;
  /**
   * K8s namespace, if applicable
   */
  k8sNamespace?: string | null | undefined;
};

/** @internal */
export const DeploymentLocation$inboundSchema: z.ZodType<
  DeploymentLocation,
  unknown
> = z.object({
  location_type: LocationType$inboundSchema,
  k8s_cluster: z.nullable(z.string()).optional(),
  k8s_namespace: z.nullable(z.string()).optional(),
}).transform((v) => {
  return remap$(v, {
    "location_type": "locationType",
    "k8s_cluster": "k8sCluster",
    "k8s_namespace": "k8sNamespace",
  });
});

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