"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.JournalEntryInput$outboundSchema = exports.JournalEntry$inboundSchema = exports.JournalEntryStatus$outboundSchema = exports.JournalEntryStatus$inboundSchema = exports.JournalEntryStatus = void 0;
exports.journalEntryFromJSON = journalEntryFromJSON;
exports.journalEntryInputToJSON = journalEntryInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const openEnums = __importStar(require("../../types/enums.js"));
const types = __importStar(require("../../types/primitives.js"));
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const journalentrylineitem_js_1 = require("./journalentrylineitem.js");
const linkedtrackingcategory_js_1 = require("./linkedtrackingcategory.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
/**
 * Journal entry status
 */
exports.JournalEntryStatus = {
    Draft: "draft",
    PendingApproval: "pending_approval",
    Approved: "approved",
    Posted: "posted",
    Voided: "voided",
    Rejected: "rejected",
    Deleted: "deleted",
    Other: "other",
};
/** @internal */
exports.JournalEntryStatus$inboundSchema = openEnums.inboundSchema(exports.JournalEntryStatus);
/** @internal */
exports.JournalEntryStatus$outboundSchema = openEnums.outboundSchema(exports.JournalEntryStatus);
/** @internal */
exports.JournalEntry$inboundSchema = z.object({
    id: types.optional(types.string()),
    downstream_id: z.nullable(types.string()).optional(),
    display_id: z.nullable(types.string()).optional(),
    title: z.nullable(types.string()).optional(),
    currency_rate: z.nullable(types.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    company_id: z.nullable(types.string()).optional(),
    line_items: types.optional(z.array(journalentrylineitem_js_1.JournalEntryLineItem$inboundSchema)),
    status: z.nullable(exports.JournalEntryStatus$inboundSchema).optional(),
    memo: z.nullable(types.string()).optional(),
    posted_at: types.optional(types.date()),
    journal_symbol: z.nullable(types.string()).optional(),
    tax_type: z.nullable(types.string()).optional(),
    tax_code: z.nullable(types.string()).optional(),
    number: z.nullable(types.string()).optional(),
    tracking_categories: z.nullable(z.array(types.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$inboundSchema))).optional(),
    accounting_period: z.nullable(types.string()).optional(),
    tax_inclusive: z.nullable(types.boolean()).optional(),
    source_type: z.nullable(types.string()).optional(),
    source_id: z.nullable(types.string()).optional(),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    updated_by: z.nullable(types.string()).optional(),
    created_by: z.nullable(types.string()).optional(),
    updated_at: z.nullable(types.date()).optional(),
    created_at: z.nullable(types.date()).optional(),
    row_version: z.nullable(types.string()).optional(),
    custom_fields: types.optional(z.array(customfield_js_1.CustomField$inboundSchema)),
    pass_through: types.optional(z.array(passthroughbody_js_1.PassThroughBody$inboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "downstream_id": "downstreamId",
        "display_id": "displayId",
        "currency_rate": "currencyRate",
        "company_id": "companyId",
        "line_items": "lineItems",
        "posted_at": "postedAt",
        "journal_symbol": "journalSymbol",
        "tax_type": "taxType",
        "tax_code": "taxCode",
        "tracking_categories": "trackingCategories",
        "accounting_period": "accountingPeriod",
        "tax_inclusive": "taxInclusive",
        "source_type": "sourceType",
        "source_id": "sourceId",
        "custom_mappings": "customMappings",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "row_version": "rowVersion",
        "custom_fields": "customFields",
        "pass_through": "passThrough",
    });
});
function journalEntryFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.JournalEntry$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'JournalEntry' from JSON`);
}
/** @internal */
exports.JournalEntryInput$outboundSchema = z.object({
    displayId: z.nullable(z.string()).optional(),
    title: z.nullable(z.string()).optional(),
    currencyRate: z.nullable(z.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$outboundSchema).optional(),
    companyId: z.nullable(z.string()).optional(),
    lineItems: z.array(journalentrylineitem_js_1.JournalEntryLineItemInput$outboundSchema).optional(),
    status: z.nullable(exports.JournalEntryStatus$outboundSchema).optional(),
    memo: z.nullable(z.string()).optional(),
    postedAt: z.date().transform(v => v.toISOString()).optional(),
    journalSymbol: z.nullable(z.string()).optional(),
    taxType: z.nullable(z.string()).optional(),
    taxCode: z.nullable(z.string()).optional(),
    number: z.nullable(z.string()).optional(),
    trackingCategories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$outboundSchema))).optional(),
    accountingPeriod: z.nullable(z.string()).optional(),
    taxInclusive: z.nullable(z.boolean()).optional(),
    sourceType: z.nullable(z.string()).optional(),
    sourceId: z.nullable(z.string()).optional(),
    rowVersion: z.nullable(z.string()).optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).optional(),
    passThrough: z.array(passthroughbody_js_1.PassThroughBody$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
        currencyRate: "currency_rate",
        companyId: "company_id",
        lineItems: "line_items",
        postedAt: "posted_at",
        journalSymbol: "journal_symbol",
        taxType: "tax_type",
        taxCode: "tax_code",
        trackingCategories: "tracking_categories",
        accountingPeriod: "accounting_period",
        taxInclusive: "tax_inclusive",
        sourceType: "source_type",
        sourceId: "source_id",
        rowVersion: "row_version",
        customFields: "custom_fields",
        passThrough: "pass_through",
    });
});
function journalEntryInputToJSON(journalEntryInput) {
    return JSON.stringify(exports.JournalEntryInput$outboundSchema.parse(journalEntryInput));
}
//# sourceMappingURL=journalentry.js.map