"use strict";
/*
 * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT.
 */
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    var desc = Object.getOwnPropertyDescriptor(m, k);
    if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
      desc = { enumerable: true, get: function() { return m[k]; } };
    }
    Object.defineProperty(o, k2, desc);
}) : (function(o, m, k, k2) {
    if (k2 === undefined) k2 = k;
    o[k2] = m[k];
}));
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
    Object.defineProperty(o, "default", { enumerable: true, value: v });
}) : function(o, v) {
    o["default"] = v;
});
var __importStar = (this && this.__importStar) || (function () {
    var ownKeys = function(o) {
        ownKeys = Object.getOwnPropertyNames || function (o) {
            var ar = [];
            for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
            return ar;
        };
        return ownKeys(o);
    };
    return function (mod) {
        if (mod && mod.__esModule) return mod;
        var result = {};
        if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
        __setModuleDefault(result, mod);
        return result;
    };
})();
Object.defineProperty(exports, "__esModule", { value: true });
exports.ListBudgetsResponseBody$outboundSchema = exports.ListBudgetsResponseBody$inboundSchema = exports.ListBudgetsData$outboundSchema = exports.ListBudgetsData$inboundSchema = exports.ListBudgetsConsumption$outboundSchema = exports.ListBudgetsConsumption$inboundSchema = exports.ListBudgetsBudget$outboundSchema = exports.ListBudgetsBudget$inboundSchema = exports.ListBudgetsPeriod$outboundSchema = exports.ListBudgetsPeriod$inboundSchema = exports.ListBudgetsType$outboundSchema = exports.ListBudgetsType$inboundSchema = exports.ListBudgetsObject$outboundSchema = exports.ListBudgetsObject$inboundSchema = exports.ListBudgetsRequest$outboundSchema = exports.ListBudgetsRequest$inboundSchema = exports.QueryParamType$outboundSchema = exports.QueryParamType$inboundSchema = exports.ListBudgetsPeriod = exports.ListBudgetsType = exports.ListBudgetsObject = exports.QueryParamType = void 0;
exports.listBudgetsRequestToJSON = listBudgetsRequestToJSON;
exports.listBudgetsRequestFromJSON = listBudgetsRequestFromJSON;
exports.listBudgetsBudgetToJSON = listBudgetsBudgetToJSON;
exports.listBudgetsBudgetFromJSON = listBudgetsBudgetFromJSON;
exports.listBudgetsConsumptionToJSON = listBudgetsConsumptionToJSON;
exports.listBudgetsConsumptionFromJSON = listBudgetsConsumptionFromJSON;
exports.listBudgetsDataToJSON = listBudgetsDataToJSON;
exports.listBudgetsDataFromJSON = listBudgetsDataFromJSON;
exports.listBudgetsResponseBodyToJSON = listBudgetsResponseBodyToJSON;
exports.listBudgetsResponseBodyFromJSON = listBudgetsResponseBodyFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const rfcdate_js_1 = require("../../types/rfcdate.js");
/**
 * Filter by budget entity type (contact or workspace)
 */
exports.QueryParamType = {
    Contact: "contact",
    Workspace: "workspace",
};
exports.ListBudgetsObject = {
    List: "list",
};
/**
 * Budget entity type
 */
exports.ListBudgetsType = {
    ApiKey: "api_key",
    Contact: "contact",
    Workspace: "workspace",
};
/**
 * Budget period type
 */
exports.ListBudgetsPeriod = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/** @internal */
exports.QueryParamType$inboundSchema = z.nativeEnum(exports.QueryParamType);
/** @internal */
exports.QueryParamType$outboundSchema = exports.QueryParamType$inboundSchema;
/** @internal */
exports.ListBudgetsRequest$inboundSchema = z.object({
    limit: z.number().default(10),
    starting_after: z.string().optional(),
    ending_before: z.string().optional(),
    type: exports.QueryParamType$inboundSchema.optional(),
    entity_id: z.string().optional(),
    is_active: z.nullable(z.boolean()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "starting_after": "startingAfter",
        "ending_before": "endingBefore",
        "entity_id": "entityId",
        "is_active": "isActive",
    });
});
/** @internal */
exports.ListBudgetsRequest$outboundSchema = z.object({
    limit: z.number().default(10),
    startingAfter: z.string().optional(),
    endingBefore: z.string().optional(),
    type: exports.QueryParamType$outboundSchema.optional(),
    entityId: z.string().optional(),
    isActive: z.nullable(z.boolean()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        startingAfter: "starting_after",
        endingBefore: "ending_before",
        entityId: "entity_id",
        isActive: "is_active",
    });
});
function listBudgetsRequestToJSON(listBudgetsRequest) {
    return JSON.stringify(exports.ListBudgetsRequest$outboundSchema.parse(listBudgetsRequest));
}
function listBudgetsRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListBudgetsRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBudgetsRequest' from JSON`);
}
/** @internal */
exports.ListBudgetsObject$inboundSchema = z.nativeEnum(exports.ListBudgetsObject);
/** @internal */
exports.ListBudgetsObject$outboundSchema = exports.ListBudgetsObject$inboundSchema;
/** @internal */
exports.ListBudgetsType$inboundSchema = z.nativeEnum(exports.ListBudgetsType);
/** @internal */
exports.ListBudgetsType$outboundSchema = exports.ListBudgetsType$inboundSchema;
/** @internal */
exports.ListBudgetsPeriod$inboundSchema = z.nativeEnum(exports.ListBudgetsPeriod);
/** @internal */
exports.ListBudgetsPeriod$outboundSchema = exports.ListBudgetsPeriod$inboundSchema;
/** @internal */
exports.ListBudgetsBudget$inboundSchema = z.object({
    period: exports.ListBudgetsPeriod$inboundSchema,
    amount: z.number(),
});
/** @internal */
exports.ListBudgetsBudget$outboundSchema = z.object({
    period: exports.ListBudgetsPeriod$outboundSchema,
    amount: z.number(),
});
function listBudgetsBudgetToJSON(listBudgetsBudget) {
    return JSON.stringify(exports.ListBudgetsBudget$outboundSchema.parse(listBudgetsBudget));
}
function listBudgetsBudgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListBudgetsBudget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBudgetsBudget' from JSON`);
}
/** @internal */
exports.ListBudgetsConsumption$inboundSchema = z.object({
    current_amount: z.number(),
    remaining_amount: z.number(),
    period_start: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v))),
    period_end: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v))),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "current_amount": "currentAmount",
        "remaining_amount": "remainingAmount",
        "period_start": "periodStart",
        "period_end": "periodEnd",
    });
});
/** @internal */
exports.ListBudgetsConsumption$outboundSchema = z.object({
    currentAmount: z.number(),
    remainingAmount: z.number(),
    periodStart: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString())),
    periodEnd: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString())),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        currentAmount: "current_amount",
        remainingAmount: "remaining_amount",
        periodStart: "period_start",
        periodEnd: "period_end",
    });
});
function listBudgetsConsumptionToJSON(listBudgetsConsumption) {
    return JSON.stringify(exports.ListBudgetsConsumption$outboundSchema.parse(listBudgetsConsumption));
}
function listBudgetsConsumptionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListBudgetsConsumption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBudgetsConsumption' from JSON`);
}
/** @internal */
exports.ListBudgetsData$inboundSchema = z.object({
    _id: z.string(),
    type: exports.ListBudgetsType$inboundSchema,
    contact_id: z.string().optional(),
    budget: z.lazy(() => exports.ListBudgetsBudget$inboundSchema),
    is_active: z.boolean(),
    consumption: z.lazy(() => exports.ListBudgetsConsumption$inboundSchema).optional(),
    created: z.string().datetime({ offset: true }).transform(v => new Date(v))
        .optional(),
    updated: z.string().datetime({ offset: true }).default("2025-11-25T16:24:23.703Z").transform(v => new Date(v)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "_id": "id",
        "contact_id": "contactId",
        "is_active": "isActive",
    });
});
/** @internal */
exports.ListBudgetsData$outboundSchema = z.object({
    id: z.string(),
    type: exports.ListBudgetsType$outboundSchema,
    contactId: z.string().optional(),
    budget: z.lazy(() => exports.ListBudgetsBudget$outboundSchema),
    isActive: z.boolean(),
    consumption: z.lazy(() => exports.ListBudgetsConsumption$outboundSchema).optional(),
    created: z.date().transform(v => v.toISOString()).optional(),
    updated: z.date().default(() => new Date("2025-11-25T16:24:23.703Z"))
        .transform(v => v.toISOString()),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        id: "_id",
        contactId: "contact_id",
        isActive: "is_active",
    });
});
function listBudgetsDataToJSON(listBudgetsData) {
    return JSON.stringify(exports.ListBudgetsData$outboundSchema.parse(listBudgetsData));
}
function listBudgetsDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListBudgetsData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBudgetsData' from JSON`);
}
/** @internal */
exports.ListBudgetsResponseBody$inboundSchema = z.object({
    object: exports.ListBudgetsObject$inboundSchema,
    data: z.array(z.lazy(() => exports.ListBudgetsData$inboundSchema)),
    has_more: z.boolean(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "has_more": "hasMore",
    });
});
/** @internal */
exports.ListBudgetsResponseBody$outboundSchema = z.object({
    object: exports.ListBudgetsObject$outboundSchema,
    data: z.array(z.lazy(() => exports.ListBudgetsData$outboundSchema)),
    hasMore: z.boolean(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        hasMore: "has_more",
    });
});
function listBudgetsResponseBodyToJSON(listBudgetsResponseBody) {
    return JSON.stringify(exports.ListBudgetsResponseBody$outboundSchema.parse(listBudgetsResponseBody));
}
function listBudgetsResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ListBudgetsResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ListBudgetsResponseBody' from JSON`);
}
//# sourceMappingURL=listbudgets.js.map