/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
import * as z from "zod";
import { remap as remap$ } from "../../lib/primitives.js";
import { safeParse } from "../../lib/schemas.js";
import { Feature$inboundSchema, Feature$outboundSchema, } from "./feature.js";
/** @internal */
export const Limit$inboundSchema = z
    .object({
    type: Feature$inboundSchema,
    used_by_request: z.nullable(z.number().int()).optional(),
    remaining: z.nullable(z.number().int()).optional(),
    limit: z.nullable(z.number().int()).optional(),
    reset_time: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
}).transform((v) => {
    return remap$(v, {
        "used_by_request": "usedByRequest",
        "reset_time": "resetTime",
    });
});
/** @internal */
export const Limit$outboundSchema = z.object({
    type: Feature$outboundSchema,
    usedByRequest: z.nullable(z.number().int()).optional(),
    remaining: z.nullable(z.number().int()).optional(),
    limit: z.nullable(z.number().int()).optional(),
    resetTime: z.nullable(z.date().transform(v => v.toISOString())).optional(),
}).transform((v) => {
    return remap$(v, {
        usedByRequest: "used_by_request",
        resetTime: "reset_time",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var Limit$;
(function (Limit$) {
    /** @deprecated use `Limit$inboundSchema` instead. */
    Limit$.inboundSchema = Limit$inboundSchema;
    /** @deprecated use `Limit$outboundSchema` instead. */
    Limit$.outboundSchema = Limit$outboundSchema;
})(Limit$ || (Limit$ = {}));
export function limitToJSON(limit) {
    return JSON.stringify(Limit$outboundSchema.parse(limit));
}
export function limitFromJSON(jsonString) {
    return safeParse(jsonString, (x) => Limit$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Limit' from JSON`);
}
/** @internal */
export const LimitsObject$inboundSchema = z.object({
    items: z.array(z.lazy(() => Limit$inboundSchema)).optional(),
});
/** @internal */
export const LimitsObject$outboundSchema = z.object({
    items: z.array(z.lazy(() => Limit$outboundSchema)).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
export var LimitsObject$;
(function (LimitsObject$) {
    /** @deprecated use `LimitsObject$inboundSchema` instead. */
    LimitsObject$.inboundSchema = LimitsObject$inboundSchema;
    /** @deprecated use `LimitsObject$outboundSchema` instead. */
    LimitsObject$.outboundSchema = LimitsObject$outboundSchema;
})(LimitsObject$ || (LimitsObject$ = {}));
export function limitsObjectToJSON(limitsObject) {
    return JSON.stringify(LimitsObject$outboundSchema.parse(limitsObject));
}
export function limitsObjectFromJSON(jsonString) {
    return safeParse(jsonString, (x) => LimitsObject$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LimitsObject' from JSON`);
}
//# sourceMappingURL=limitsobject.js.map