/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 * @generated-id: 3ca6e3280e43
 */
import * as z from "zod/v4";
export function bigint() {
    return z.union([
        z.bigint().transform((v) => String(v)),
        z.string().transform((v, ctx) => {
            try {
                return BigInt(v);
            }
            catch {
                ctx.addIssue({
                    code: z.ZodIssueCode.custom,
                    message: "Invalid bigint value",
                });
                return z.NEVER;
            }
        }),
        z.number().transform((v) => BigInt(Math.trunc(v))),
        z.union([z.null(), z.undefined()]).transform(() => BigInt(0)),
    ]);
}
export function bigintOptional() {
    return z.union([
        z.bigint().transform((v) => String(v)),
        z.string().transform((v, ctx) => {
            try {
                return BigInt(v);
            }
            catch {
                ctx.addIssue({
                    code: z.ZodIssueCode.custom,
                    message: "Invalid bigint value",
                });
                return z.NEVER;
            }
        }),
        z.number().transform((v) => BigInt(Math.trunc(v))),
        z.undefined(),
        z.null().transform(() => undefined),
    ]);
}
export function bigintNullable() {
    return z.union([
        z.bigint().transform((v) => String(v)),
        z.string().transform((v, ctx) => {
            try {
                return BigInt(v);
            }
            catch {
                ctx.addIssue({
                    code: z.ZodIssueCode.custom,
                    message: "Invalid bigint value",
                });
                return z.NEVER;
            }
        }),
        z.number().transform((v) => BigInt(Math.trunc(v))),
        z.null(),
        z.undefined().transform(() => null),
    ]);
}
export function bigintConst(value) {
    return z
        .union([
        z.bigint(),
        z.string().transform((v, ctx) => {
            try {
                return BigInt(v);
            }
            catch {
                ctx.addIssue({
                    code: z.ZodIssueCode.custom,
                    message: "Invalid bigint value",
                });
                return z.NEVER;
            }
        }),
        z.number().transform((v) => BigInt(Math.trunc(v))),
    ])
        .refine((v) => v === value, {
        message: `Value must be ${value}`,
    })
        .transform(() => value);
}
//# sourceMappingURL=bigint.js.map