"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.GetBudgetResponseBody$outboundSchema = exports.GetBudgetResponseBody$inboundSchema = exports.GetBudgetConsumption$outboundSchema = exports.GetBudgetConsumption$inboundSchema = exports.GetBudgetBudget$outboundSchema = exports.GetBudgetBudget$inboundSchema = exports.GetBudgetPeriod$outboundSchema = exports.GetBudgetPeriod$inboundSchema = exports.GetBudgetType$outboundSchema = exports.GetBudgetType$inboundSchema = exports.GetBudgetRequest$outboundSchema = exports.GetBudgetRequest$inboundSchema = exports.GetBudgetPeriod = exports.GetBudgetType = void 0;
exports.getBudgetRequestToJSON = getBudgetRequestToJSON;
exports.getBudgetRequestFromJSON = getBudgetRequestFromJSON;
exports.getBudgetBudgetToJSON = getBudgetBudgetToJSON;
exports.getBudgetBudgetFromJSON = getBudgetBudgetFromJSON;
exports.getBudgetConsumptionToJSON = getBudgetConsumptionToJSON;
exports.getBudgetConsumptionFromJSON = getBudgetConsumptionFromJSON;
exports.getBudgetResponseBodyToJSON = getBudgetResponseBodyToJSON;
exports.getBudgetResponseBodyFromJSON = getBudgetResponseBodyFromJSON;
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");
/**
 * Budget entity type
 */
exports.GetBudgetType = {
    ApiKey: "api_key",
    Contact: "contact",
    Workspace: "workspace",
};
/**
 * Budget period type
 */
exports.GetBudgetPeriod = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/** @internal */
exports.GetBudgetRequest$inboundSchema = z.object({
    id: z.string(),
});
/** @internal */
exports.GetBudgetRequest$outboundSchema = z.object({
    id: z.string(),
});
function getBudgetRequestToJSON(getBudgetRequest) {
    return JSON.stringify(exports.GetBudgetRequest$outboundSchema.parse(getBudgetRequest));
}
function getBudgetRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.GetBudgetRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetBudgetRequest' from JSON`);
}
/** @internal */
exports.GetBudgetType$inboundSchema = z.nativeEnum(exports.GetBudgetType);
/** @internal */
exports.GetBudgetType$outboundSchema = exports.GetBudgetType$inboundSchema;
/** @internal */
exports.GetBudgetPeriod$inboundSchema = z.nativeEnum(exports.GetBudgetPeriod);
/** @internal */
exports.GetBudgetPeriod$outboundSchema = exports.GetBudgetPeriod$inboundSchema;
/** @internal */
exports.GetBudgetBudget$inboundSchema = z.object({
    period: exports.GetBudgetPeriod$inboundSchema,
    amount: z.number(),
});
/** @internal */
exports.GetBudgetBudget$outboundSchema = z.object({
    period: exports.GetBudgetPeriod$outboundSchema,
    amount: z.number(),
});
function getBudgetBudgetToJSON(getBudgetBudget) {
    return JSON.stringify(exports.GetBudgetBudget$outboundSchema.parse(getBudgetBudget));
}
function getBudgetBudgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.GetBudgetBudget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetBudgetBudget' from JSON`);
}
/** @internal */
exports.GetBudgetConsumption$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.GetBudgetConsumption$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 getBudgetConsumptionToJSON(getBudgetConsumption) {
    return JSON.stringify(exports.GetBudgetConsumption$outboundSchema.parse(getBudgetConsumption));
}
function getBudgetConsumptionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.GetBudgetConsumption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetBudgetConsumption' from JSON`);
}
/** @internal */
exports.GetBudgetResponseBody$inboundSchema = z.object({
    _id: z.string(),
    workspace_id: z.string(),
    type: exports.GetBudgetType$inboundSchema,
    contact_id: z.string().optional(),
    budget: z.lazy(() => exports.GetBudgetBudget$inboundSchema),
    is_active: z.boolean(),
    consumption: z.lazy(() => exports.GetBudgetConsumption$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",
        "workspace_id": "workspaceId",
        "contact_id": "contactId",
        "is_active": "isActive",
    });
});
/** @internal */
exports.GetBudgetResponseBody$outboundSchema = z.object({
    id: z.string(),
    workspaceId: z.string(),
    type: exports.GetBudgetType$outboundSchema,
    contactId: z.string().optional(),
    budget: z.lazy(() => exports.GetBudgetBudget$outboundSchema),
    isActive: z.boolean(),
    consumption: z.lazy(() => exports.GetBudgetConsumption$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",
        workspaceId: "workspace_id",
        contactId: "contact_id",
        isActive: "is_active",
    });
});
function getBudgetResponseBodyToJSON(getBudgetResponseBody) {
    return JSON.stringify(exports.GetBudgetResponseBody$outboundSchema.parse(getBudgetResponseBody));
}
function getBudgetResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.GetBudgetResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'GetBudgetResponseBody' from JSON`);
}
//# sourceMappingURL=getbudget.js.map