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

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";

export type AuthUrlResponse = {
  authUrl: string;
  ttl: number;
};

/** @internal */
export const AuthUrlResponse$inboundSchema: z.ZodType<
  AuthUrlResponse,
  unknown
> = z.object({
  auth_url: z.string(),
  ttl: z.int(),
}).transform((v) => {
  return remap$(v, {
    "auth_url": "authUrl",
  });
});

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