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

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 {
  AuthenticationType,
  AuthenticationType$inboundSchema,
} from "./authenticationtype.js";

export type AuthenticationConfiguration = {
  name: string;
  authenticationType: AuthenticationType;
  isDefault: boolean;
};

/** @internal */
export const AuthenticationConfiguration$inboundSchema: z.ZodType<
  AuthenticationConfiguration,
  unknown
> = z.object({
  name: z.string(),
  authentication_type: AuthenticationType$inboundSchema,
  is_default: z.boolean().default(false),
}).transform((v) => {
  return remap$(v, {
    "authentication_type": "authenticationType",
    "is_default": "isDefault",
  });
});

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