"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.UpdateBudgetResponseBody$outboundSchema = exports.UpdateBudgetResponseBody$inboundSchema = exports.UpdateBudgetConsumption$outboundSchema = exports.UpdateBudgetConsumption$inboundSchema = exports.UpdateBudgetBudget$outboundSchema = exports.UpdateBudgetBudget$inboundSchema = exports.UpdateBudgetPeriod$outboundSchema = exports.UpdateBudgetPeriod$inboundSchema = exports.UpdateBudgetType$outboundSchema = exports.UpdateBudgetType$inboundSchema = exports.UpdateBudgetRequest$outboundSchema = exports.UpdateBudgetRequest$inboundSchema = exports.UpdateBudgetRequestBody$outboundSchema = exports.UpdateBudgetRequestBody$inboundSchema = exports.Budget$outboundSchema = exports.Budget$inboundSchema = exports.Period$outboundSchema = exports.Period$inboundSchema = exports.UpdateBudgetPeriod = exports.UpdateBudgetType = exports.Period = void 0;
exports.budgetToJSON = budgetToJSON;
exports.budgetFromJSON = budgetFromJSON;
exports.updateBudgetRequestBodyToJSON = updateBudgetRequestBodyToJSON;
exports.updateBudgetRequestBodyFromJSON = updateBudgetRequestBodyFromJSON;
exports.updateBudgetRequestToJSON = updateBudgetRequestToJSON;
exports.updateBudgetRequestFromJSON = updateBudgetRequestFromJSON;
exports.updateBudgetBudgetToJSON = updateBudgetBudgetToJSON;
exports.updateBudgetBudgetFromJSON = updateBudgetBudgetFromJSON;
exports.updateBudgetConsumptionToJSON = updateBudgetConsumptionToJSON;
exports.updateBudgetConsumptionFromJSON = updateBudgetConsumptionFromJSON;
exports.updateBudgetResponseBodyToJSON = updateBudgetResponseBodyToJSON;
exports.updateBudgetResponseBodyFromJSON = updateBudgetResponseBodyFromJSON;
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 period type
 */
exports.Period = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/**
 * Budget entity type
 */
exports.UpdateBudgetType = {
    ApiKey: "api_key",
    Contact: "contact",
    Workspace: "workspace",
};
/**
 * Budget period type
 */
exports.UpdateBudgetPeriod = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/** @internal */
exports.Period$inboundSchema = z
    .nativeEnum(exports.Period);
/** @internal */
exports.Period$outboundSchema = exports.Period$inboundSchema;
/** @internal */
exports.Budget$inboundSchema = z
    .object({
    period: exports.Period$inboundSchema.optional(),
    amount: z.number().optional(),
});
/** @internal */
exports.Budget$outboundSchema = z.object({
    period: exports.Period$outboundSchema.optional(),
    amount: z.number().optional(),
});
function budgetToJSON(budget) {
    return JSON.stringify(exports.Budget$outboundSchema.parse(budget));
}
function budgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Budget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Budget' from JSON`);
}
/** @internal */
exports.UpdateBudgetRequestBody$inboundSchema = z.object({
    budget: z.lazy(() => exports.Budget$inboundSchema).optional(),
    is_active: z.boolean().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "is_active": "isActive",
    });
});
/** @internal */
exports.UpdateBudgetRequestBody$outboundSchema = z.object({
    budget: z.lazy(() => exports.Budget$outboundSchema).optional(),
    isActive: z.boolean().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        isActive: "is_active",
    });
});
function updateBudgetRequestBodyToJSON(updateBudgetRequestBody) {
    return JSON.stringify(exports.UpdateBudgetRequestBody$outboundSchema.parse(updateBudgetRequestBody));
}
function updateBudgetRequestBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UpdateBudgetRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateBudgetRequestBody' from JSON`);
}
/** @internal */
exports.UpdateBudgetRequest$inboundSchema = z.object({
    id: z.string(),
    RequestBody: z.lazy(() => exports.UpdateBudgetRequestBody$inboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "RequestBody": "requestBody",
    });
});
/** @internal */
exports.UpdateBudgetRequest$outboundSchema = z.object({
    id: z.string(),
    requestBody: z.lazy(() => exports.UpdateBudgetRequestBody$outboundSchema),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        requestBody: "RequestBody",
    });
});
function updateBudgetRequestToJSON(updateBudgetRequest) {
    return JSON.stringify(exports.UpdateBudgetRequest$outboundSchema.parse(updateBudgetRequest));
}
function updateBudgetRequestFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UpdateBudgetRequest$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateBudgetRequest' from JSON`);
}
/** @internal */
exports.UpdateBudgetType$inboundSchema = z.nativeEnum(exports.UpdateBudgetType);
/** @internal */
exports.UpdateBudgetType$outboundSchema = exports.UpdateBudgetType$inboundSchema;
/** @internal */
exports.UpdateBudgetPeriod$inboundSchema = z.nativeEnum(exports.UpdateBudgetPeriod);
/** @internal */
exports.UpdateBudgetPeriod$outboundSchema = exports.UpdateBudgetPeriod$inboundSchema;
/** @internal */
exports.UpdateBudgetBudget$inboundSchema = z.object({
    period: exports.UpdateBudgetPeriod$inboundSchema,
    amount: z.number(),
});
/** @internal */
exports.UpdateBudgetBudget$outboundSchema = z.object({
    period: exports.UpdateBudgetPeriod$outboundSchema,
    amount: z.number(),
});
function updateBudgetBudgetToJSON(updateBudgetBudget) {
    return JSON.stringify(exports.UpdateBudgetBudget$outboundSchema.parse(updateBudgetBudget));
}
function updateBudgetBudgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UpdateBudgetBudget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateBudgetBudget' from JSON`);
}
/** @internal */
exports.UpdateBudgetConsumption$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.UpdateBudgetConsumption$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 updateBudgetConsumptionToJSON(updateBudgetConsumption) {
    return JSON.stringify(exports.UpdateBudgetConsumption$outboundSchema.parse(updateBudgetConsumption));
}
function updateBudgetConsumptionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UpdateBudgetConsumption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateBudgetConsumption' from JSON`);
}
/** @internal */
exports.UpdateBudgetResponseBody$inboundSchema = z.object({
    _id: z.string(),
    workspace_id: z.string(),
    type: exports.UpdateBudgetType$inboundSchema,
    contact_id: z.string().optional(),
    budget: z.lazy(() => exports.UpdateBudgetBudget$inboundSchema),
    is_active: z.boolean(),
    consumption: z.lazy(() => exports.UpdateBudgetConsumption$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.UpdateBudgetResponseBody$outboundSchema = z.object({
    id: z.string(),
    workspaceId: z.string(),
    type: exports.UpdateBudgetType$outboundSchema,
    contactId: z.string().optional(),
    budget: z.lazy(() => exports.UpdateBudgetBudget$outboundSchema),
    isActive: z.boolean(),
    consumption: z.lazy(() => exports.UpdateBudgetConsumption$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 updateBudgetResponseBodyToJSON(updateBudgetResponseBody) {
    return JSON.stringify(exports.UpdateBudgetResponseBody$outboundSchema.parse(updateBudgetResponseBody));
}
function updateBudgetResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UpdateBudgetResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UpdateBudgetResponseBody' from JSON`);
}
//# sourceMappingURL=updatebudget.js.map