"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.CreateBudgetResponseBody$outboundSchema = exports.CreateBudgetResponseBody$inboundSchema = exports.Consumption$outboundSchema = exports.Consumption$inboundSchema = exports.CreateBudgetBudget$outboundSchema = exports.CreateBudgetBudget$inboundSchema = exports.CreateBudgetPeriod$outboundSchema = exports.CreateBudgetPeriod$inboundSchema = exports.CreateBudgetType$outboundSchema = exports.CreateBudgetType$inboundSchema = exports.CreateBudgetRequestBody$outboundSchema = exports.CreateBudgetRequestBody$inboundSchema = exports.ContactBudget$outboundSchema = exports.ContactBudget$inboundSchema = exports.CreateBudgetRequestBodyPeriod$outboundSchema = exports.CreateBudgetRequestBodyPeriod$inboundSchema = exports.CreateBudgetRequestBodyType$outboundSchema = exports.CreateBudgetRequestBodyType$inboundSchema = exports.WorkspaceBudget$outboundSchema = exports.WorkspaceBudget$inboundSchema = exports.RequestBodyPeriod$outboundSchema = exports.RequestBodyPeriod$inboundSchema = exports.CreateBudgetRequestBodyBudgetsType$outboundSchema = exports.CreateBudgetRequestBodyBudgetsType$inboundSchema = exports.CreateBudgetPeriod = exports.CreateBudgetType = exports.CreateBudgetRequestBodyPeriod = exports.CreateBudgetRequestBodyType = exports.RequestBodyPeriod = exports.CreateBudgetRequestBodyBudgetsType = void 0;
exports.workspaceBudgetToJSON = workspaceBudgetToJSON;
exports.workspaceBudgetFromJSON = workspaceBudgetFromJSON;
exports.contactBudgetToJSON = contactBudgetToJSON;
exports.contactBudgetFromJSON = contactBudgetFromJSON;
exports.createBudgetRequestBodyToJSON = createBudgetRequestBodyToJSON;
exports.createBudgetRequestBodyFromJSON = createBudgetRequestBodyFromJSON;
exports.createBudgetBudgetToJSON = createBudgetBudgetToJSON;
exports.createBudgetBudgetFromJSON = createBudgetBudgetFromJSON;
exports.consumptionToJSON = consumptionToJSON;
exports.consumptionFromJSON = consumptionFromJSON;
exports.createBudgetResponseBodyToJSON = createBudgetResponseBodyToJSON;
exports.createBudgetResponseBodyFromJSON = createBudgetResponseBodyFromJSON;
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");
/**
 * Workspace budget type
 */
exports.CreateBudgetRequestBodyBudgetsType = {
    Workspace: "workspace",
};
/**
 * Budget period type
 */
exports.RequestBodyPeriod = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/**
 * Contact budget type
 */
exports.CreateBudgetRequestBodyType = {
    Contact: "contact",
};
/**
 * Budget period type
 */
exports.CreateBudgetRequestBodyPeriod = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/**
 * Budget entity type
 */
exports.CreateBudgetType = {
    ApiKey: "api_key",
    Contact: "contact",
    Workspace: "workspace",
};
/**
 * Budget period type
 */
exports.CreateBudgetPeriod = {
    Daily: "daily",
    Weekly: "weekly",
    Monthly: "monthly",
    Yearly: "yearly",
};
/** @internal */
exports.CreateBudgetRequestBodyBudgetsType$inboundSchema = z.nativeEnum(exports.CreateBudgetRequestBodyBudgetsType);
/** @internal */
exports.CreateBudgetRequestBodyBudgetsType$outboundSchema = exports.CreateBudgetRequestBodyBudgetsType$inboundSchema;
/** @internal */
exports.RequestBodyPeriod$inboundSchema = z.nativeEnum(exports.RequestBodyPeriod);
/** @internal */
exports.RequestBodyPeriod$outboundSchema = exports.RequestBodyPeriod$inboundSchema;
/** @internal */
exports.WorkspaceBudget$inboundSchema = z.object({
    type: exports.CreateBudgetRequestBodyBudgetsType$inboundSchema,
    period: exports.RequestBodyPeriod$inboundSchema,
    amount: z.number(),
});
/** @internal */
exports.WorkspaceBudget$outboundSchema = z.object({
    type: exports.CreateBudgetRequestBodyBudgetsType$outboundSchema,
    period: exports.RequestBodyPeriod$outboundSchema,
    amount: z.number(),
});
function workspaceBudgetToJSON(workspaceBudget) {
    return JSON.stringify(exports.WorkspaceBudget$outboundSchema.parse(workspaceBudget));
}
function workspaceBudgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.WorkspaceBudget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'WorkspaceBudget' from JSON`);
}
/** @internal */
exports.CreateBudgetRequestBodyType$inboundSchema = z.nativeEnum(exports.CreateBudgetRequestBodyType);
/** @internal */
exports.CreateBudgetRequestBodyType$outboundSchema = exports.CreateBudgetRequestBodyType$inboundSchema;
/** @internal */
exports.CreateBudgetRequestBodyPeriod$inboundSchema = z.nativeEnum(exports.CreateBudgetRequestBodyPeriod);
/** @internal */
exports.CreateBudgetRequestBodyPeriod$outboundSchema = exports.CreateBudgetRequestBodyPeriod$inboundSchema;
/** @internal */
exports.ContactBudget$inboundSchema = z.object({
    type: exports.CreateBudgetRequestBodyType$inboundSchema,
    entity_id: z.string(),
    period: exports.CreateBudgetRequestBodyPeriod$inboundSchema,
    amount: z.number(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "entity_id": "entityId",
    });
});
/** @internal */
exports.ContactBudget$outboundSchema = z.object({
    type: exports.CreateBudgetRequestBodyType$outboundSchema,
    entityId: z.string(),
    period: exports.CreateBudgetRequestBodyPeriod$outboundSchema,
    amount: z.number(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        entityId: "entity_id",
    });
});
function contactBudgetToJSON(contactBudget) {
    return JSON.stringify(exports.ContactBudget$outboundSchema.parse(contactBudget));
}
function contactBudgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ContactBudget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ContactBudget' from JSON`);
}
/** @internal */
exports.CreateBudgetRequestBody$inboundSchema = z.union([
    z.lazy(() => exports.ContactBudget$inboundSchema),
    z.lazy(() => exports.WorkspaceBudget$inboundSchema),
]);
/** @internal */
exports.CreateBudgetRequestBody$outboundSchema = z.union([
    z.lazy(() => exports.ContactBudget$outboundSchema),
    z.lazy(() => exports.WorkspaceBudget$outboundSchema),
]);
function createBudgetRequestBodyToJSON(createBudgetRequestBody) {
    return JSON.stringify(exports.CreateBudgetRequestBody$outboundSchema.parse(createBudgetRequestBody));
}
function createBudgetRequestBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateBudgetRequestBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBudgetRequestBody' from JSON`);
}
/** @internal */
exports.CreateBudgetType$inboundSchema = z.nativeEnum(exports.CreateBudgetType);
/** @internal */
exports.CreateBudgetType$outboundSchema = exports.CreateBudgetType$inboundSchema;
/** @internal */
exports.CreateBudgetPeriod$inboundSchema = z.nativeEnum(exports.CreateBudgetPeriod);
/** @internal */
exports.CreateBudgetPeriod$outboundSchema = exports.CreateBudgetPeriod$inboundSchema;
/** @internal */
exports.CreateBudgetBudget$inboundSchema = z.object({
    period: exports.CreateBudgetPeriod$inboundSchema,
    amount: z.number(),
});
/** @internal */
exports.CreateBudgetBudget$outboundSchema = z.object({
    period: exports.CreateBudgetPeriod$outboundSchema,
    amount: z.number(),
});
function createBudgetBudgetToJSON(createBudgetBudget) {
    return JSON.stringify(exports.CreateBudgetBudget$outboundSchema.parse(createBudgetBudget));
}
function createBudgetBudgetFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateBudgetBudget$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBudgetBudget' from JSON`);
}
/** @internal */
exports.Consumption$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.Consumption$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 consumptionToJSON(consumption) {
    return JSON.stringify(exports.Consumption$outboundSchema.parse(consumption));
}
function consumptionFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Consumption$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Consumption' from JSON`);
}
/** @internal */
exports.CreateBudgetResponseBody$inboundSchema = z.object({
    _id: z.string(),
    workspace_id: z.string(),
    type: exports.CreateBudgetType$inboundSchema,
    contact_id: z.string().optional(),
    budget: z.lazy(() => exports.CreateBudgetBudget$inboundSchema),
    is_active: z.boolean(),
    consumption: z.lazy(() => exports.Consumption$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.CreateBudgetResponseBody$outboundSchema = z.object({
    id: z.string(),
    workspaceId: z.string(),
    type: exports.CreateBudgetType$outboundSchema,
    contactId: z.string().optional(),
    budget: z.lazy(() => exports.CreateBudgetBudget$outboundSchema),
    isActive: z.boolean(),
    consumption: z.lazy(() => exports.Consumption$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 createBudgetResponseBodyToJSON(createBudgetResponseBody) {
    return JSON.stringify(exports.CreateBudgetResponseBody$outboundSchema.parse(createBudgetResponseBody));
}
function createBudgetResponseBodyFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CreateBudgetResponseBody$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CreateBudgetResponseBody' from JSON`);
}
//# sourceMappingURL=createbudget.js.map