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

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

export type CostMetadataOutput = {
  /**
   * The amount in cents.
   */
  amount: string;
  /**
   * The currency. Currently, only `usd` is supported.
   */
  currency: string;
};

/** @internal */
export const CostMetadataOutput$inboundSchema: z.ZodMiniType<
  CostMetadataOutput,
  unknown
> = z.object({
  amount: z.string(),
  currency: z.string(),
});

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