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

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

export const GetTokenFromConfidentialAuthCodeServerList = [
  /**
   * For the developer environment, the URI is https://account-d.docusign.com/oauth/token
   */
  "https://account-d.docusign.com",
  /**
   * For the production environment, the URI is https://account.docusign.com/oauth/token
   */
  "https://account.docusign.com",
] as const;

export type GetTokenFromConfidentialAuthCodeSecurity = {
  clientId: string;
  secretKey: string;
};

/** @internal */
export const GetTokenFromConfidentialAuthCodeSecurity$inboundSchema: z.ZodType<
  GetTokenFromConfidentialAuthCodeSecurity,
  z.ZodTypeDef,
  unknown
> = z.object({
  clientId: z.string(),
  secretKey: z.string(),
});

/** @internal */
export type GetTokenFromConfidentialAuthCodeSecurity$Outbound = {
  clientId: string;
  secretKey: string;
};

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

/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export namespace GetTokenFromConfidentialAuthCodeSecurity$ {
  /** @deprecated use `GetTokenFromConfidentialAuthCodeSecurity$inboundSchema` instead. */
  export const inboundSchema =
    GetTokenFromConfidentialAuthCodeSecurity$inboundSchema;
  /** @deprecated use `GetTokenFromConfidentialAuthCodeSecurity$outboundSchema` instead. */
  export const outboundSchema =
    GetTokenFromConfidentialAuthCodeSecurity$outboundSchema;
  /** @deprecated use `GetTokenFromConfidentialAuthCodeSecurity$Outbound` instead. */
  export type Outbound = GetTokenFromConfidentialAuthCodeSecurity$Outbound;
}

export function getTokenFromConfidentialAuthCodeSecurityToJSON(
  getTokenFromConfidentialAuthCodeSecurity:
    GetTokenFromConfidentialAuthCodeSecurity,
): string {
  return JSON.stringify(
    GetTokenFromConfidentialAuthCodeSecurity$outboundSchema.parse(
      getTokenFromConfidentialAuthCodeSecurity,
    ),
  );
}

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