"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.JournalEntryLineItemInput$outboundSchema = exports.JournalEntryLineItem$inboundSchema = exports.JournalEntryLineItemType$outboundSchema = exports.JournalEntryLineItemType$inboundSchema = exports.JournalEntryLineItemType = void 0;
exports.journalEntryLineItemFromJSON = journalEntryLineItemFromJSON;
exports.journalEntryLineItemInputToJSON = journalEntryLineItemInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const deprecatedlinkedtrackingcategory_js_1 = require("./deprecatedlinkedtrackingcategory.js");
const linkedcustomer_js_1 = require("./linkedcustomer.js");
const linkedcustomerinput_js_1 = require("./linkedcustomerinput.js");
const linkedledgeraccount_js_1 = require("./linkedledgeraccount.js");
const linkedsupplier_js_1 = require("./linkedsupplier.js");
const linkedsupplierinput_js_1 = require("./linkedsupplierinput.js");
const linkedtaxrate_js_1 = require("./linkedtaxrate.js");
const linkedtaxrateinput_js_1 = require("./linkedtaxrateinput.js");
const linkedtrackingcategory_js_1 = require("./linkedtrackingcategory.js");
const linkedworktag_js_1 = require("./linkedworktag.js");
/**
 * Debit entries are considered positive, and credit entries are considered negative.
 */
exports.JournalEntryLineItemType = {
    Debit: "debit",
    Credit: "credit",
};
/** @internal */
exports.JournalEntryLineItemType$inboundSchema = z.nativeEnum(exports.JournalEntryLineItemType);
/** @internal */
exports.JournalEntryLineItemType$outboundSchema = exports.JournalEntryLineItemType$inboundSchema;
/** @internal */
exports.JournalEntryLineItem$inboundSchema = z.object({
    id: z.string().optional(),
    description: z.nullable(z.string()).optional(),
    tax_amount: z.nullable(z.number()).optional(),
    sub_total: z.nullable(z.number()).optional(),
    total_amount: z.nullable(z.number()).optional(),
    type: exports.JournalEntryLineItemType$inboundSchema,
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$inboundSchema.optional(),
    tracking_category: z.nullable(deprecatedlinkedtrackingcategory_js_1.DeprecatedLinkedTrackingCategory$inboundSchema)
        .optional(),
    tracking_categories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$inboundSchema))).optional(),
    ledger_account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$inboundSchema),
    customer: z.nullable(linkedcustomer_js_1.LinkedCustomer$inboundSchema).optional(),
    supplier: z.nullable(linkedsupplier_js_1.LinkedSupplier$inboundSchema).optional(),
    department_id: z.nullable(z.string()).optional(),
    location_id: z.nullable(z.string()).optional(),
    line_number: z.nullable(z.number().int()).optional(),
    worktags: z.array(z.nullable(linkedworktag_js_1.LinkedWorktag$inboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "tax_amount": "taxAmount",
        "sub_total": "subTotal",
        "total_amount": "totalAmount",
        "tax_rate": "taxRate",
        "tracking_category": "trackingCategory",
        "tracking_categories": "trackingCategories",
        "ledger_account": "ledgerAccount",
        "department_id": "departmentId",
        "location_id": "locationId",
        "line_number": "lineNumber",
    });
});
function journalEntryLineItemFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.JournalEntryLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'JournalEntryLineItem' from JSON`);
}
/** @internal */
exports.JournalEntryLineItemInput$outboundSchema = z.object({
    description: z.nullable(z.string()).optional(),
    taxAmount: z.nullable(z.number()).optional(),
    subTotal: z.nullable(z.number()).optional(),
    totalAmount: z.nullable(z.number()).optional(),
    type: exports.JournalEntryLineItemType$outboundSchema,
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
    trackingCategory: z.nullable(deprecatedlinkedtrackingcategory_js_1.DeprecatedLinkedTrackingCategory$outboundSchema)
        .optional(),
    trackingCategories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$outboundSchema))).optional(),
    ledgerAccount: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$outboundSchema),
    customer: z.nullable(linkedcustomerinput_js_1.LinkedCustomerInput$outboundSchema).optional(),
    supplier: z.nullable(linkedsupplierinput_js_1.LinkedSupplierInput$outboundSchema).optional(),
    departmentId: z.nullable(z.string()).optional(),
    locationId: z.nullable(z.string()).optional(),
    lineNumber: z.nullable(z.number().int()).optional(),
    worktags: z.array(z.nullable(linkedworktag_js_1.LinkedWorktag$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        taxAmount: "tax_amount",
        subTotal: "sub_total",
        totalAmount: "total_amount",
        taxRate: "tax_rate",
        trackingCategory: "tracking_category",
        trackingCategories: "tracking_categories",
        ledgerAccount: "ledger_account",
        departmentId: "department_id",
        locationId: "location_id",
        lineNumber: "line_number",
    });
});
function journalEntryLineItemInputToJSON(journalEntryLineItemInput) {
    return JSON.stringify(exports.JournalEntryLineItemInput$outboundSchema.parse(journalEntryLineItemInput));
}
//# sourceMappingURL=journalentrylineitem.js.map