"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.InvoiceItemInput$outboundSchema = exports.InvoiceItemPurchaseDetails$outboundSchema = exports.InvoiceItemSalesDetails$outboundSchema = exports.InvoiceItem$inboundSchema = exports.PurchaseDetails$inboundSchema = exports.SalesDetails$inboundSchema = exports.InvoiceItemTypeType$outboundSchema = exports.InvoiceItemTypeType$inboundSchema = exports.InvoiceItemTypeType = void 0;
exports.salesDetailsFromJSON = salesDetailsFromJSON;
exports.purchaseDetailsFromJSON = purchaseDetailsFromJSON;
exports.invoiceItemFromJSON = invoiceItemFromJSON;
exports.invoiceItemSalesDetailsToJSON = invoiceItemSalesDetailsToJSON;
exports.invoiceItemPurchaseDetailsToJSON = invoiceItemPurchaseDetailsToJSON;
exports.invoiceItemInputToJSON = invoiceItemInputToJSON;
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");
const currency_js_1 = require("./currency.js");
const deprecatedlinkedtrackingcategory_js_1 = require("./deprecatedlinkedtrackingcategory.js");
const linkedledgeraccount_js_1 = require("./linkedledgeraccount.js");
const linkedtaxrate_js_1 = require("./linkedtaxrate.js");
const linkedtaxrateinput_js_1 = require("./linkedtaxrateinput.js");
const linkedtrackingcategory_js_1 = require("./linkedtrackingcategory.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
/**
 * Item type
 */
exports.InvoiceItemTypeType = {
    Inventory: "inventory",
    NonInventory: "non_inventory",
    Service: "service",
    Description: "description",
    Other: "other",
};
/** @internal */
exports.InvoiceItemTypeType$inboundSchema = z.nativeEnum(exports.InvoiceItemTypeType);
/** @internal */
exports.InvoiceItemTypeType$outboundSchema = exports.InvoiceItemTypeType$inboundSchema;
/** @internal */
exports.SalesDetails$inboundSchema = z.object({
    unit_price: z.nullable(z.number()).optional(),
    unit_of_measure: z.nullable(z.string()).optional(),
    tax_inclusive: z.nullable(z.boolean()).optional(),
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$inboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "unit_price": "unitPrice",
        "unit_of_measure": "unitOfMeasure",
        "tax_inclusive": "taxInclusive",
        "tax_rate": "taxRate",
    });
});
function salesDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.SalesDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SalesDetails' from JSON`);
}
/** @internal */
exports.PurchaseDetails$inboundSchema = z.object({
    unit_price: z.nullable(z.number()).optional(),
    unit_of_measure: z.nullable(z.string()).optional(),
    tax_inclusive: z.nullable(z.boolean()).optional(),
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$inboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "unit_price": "unitPrice",
        "unit_of_measure": "unitOfMeasure",
        "tax_inclusive": "taxInclusive",
        "tax_rate": "taxRate",
    });
});
function purchaseDetailsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.PurchaseDetails$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'PurchaseDetails' from JSON`);
}
/** @internal */
exports.InvoiceItem$inboundSchema = z.object({
    id: z.string().optional(),
    name: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    display_id: z.nullable(z.string()).optional(),
    code: z.nullable(z.string()).optional(),
    sold: z.nullable(z.boolean()).optional(),
    purchased: z.nullable(z.boolean()).optional(),
    tracked: z.nullable(z.boolean()).optional(),
    taxable: z.nullable(z.boolean()).optional(),
    inventory_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v)))
        .optional(),
    type: z.nullable(exports.InvoiceItemTypeType$inboundSchema).optional(),
    sales_details: z.lazy(() => exports.SalesDetails$inboundSchema).optional(),
    purchase_details: z.lazy(() => exports.PurchaseDetails$inboundSchema).optional(),
    quantity: z.nullable(z.number()).optional(),
    unit_price: z.nullable(z.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    asset_account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$inboundSchema).optional(),
    income_account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$inboundSchema).optional(),
    expense_account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$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(),
    active: z.nullable(z.boolean()).optional(),
    department_id: z.nullable(z.string()).optional(),
    location_id: z.nullable(z.string()).optional(),
    subsidiary_id: z.nullable(z.string()).optional(),
    tax_schedule_id: z.nullable(z.string()).optional(),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    row_version: z.nullable(z.string()).optional(),
    updated_by: z.nullable(z.string()).optional(),
    created_by: z.nullable(z.string()).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    pass_through: z.array(passthroughbody_js_1.PassThroughBody$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "display_id": "displayId",
        "inventory_date": "inventoryDate",
        "sales_details": "salesDetails",
        "purchase_details": "purchaseDetails",
        "unit_price": "unitPrice",
        "asset_account": "assetAccount",
        "income_account": "incomeAccount",
        "expense_account": "expenseAccount",
        "tracking_category": "trackingCategory",
        "tracking_categories": "trackingCategories",
        "department_id": "departmentId",
        "location_id": "locationId",
        "subsidiary_id": "subsidiaryId",
        "tax_schedule_id": "taxScheduleId",
        "custom_mappings": "customMappings",
        "row_version": "rowVersion",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "pass_through": "passThrough",
    });
});
function invoiceItemFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.InvoiceItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'InvoiceItem' from JSON`);
}
/** @internal */
exports.InvoiceItemSalesDetails$outboundSchema = z.object({
    unitPrice: z.nullable(z.number()).optional(),
    unitOfMeasure: z.nullable(z.string()).optional(),
    taxInclusive: z.nullable(z.boolean()).optional(),
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        unitPrice: "unit_price",
        unitOfMeasure: "unit_of_measure",
        taxInclusive: "tax_inclusive",
        taxRate: "tax_rate",
    });
});
function invoiceItemSalesDetailsToJSON(invoiceItemSalesDetails) {
    return JSON.stringify(exports.InvoiceItemSalesDetails$outboundSchema.parse(invoiceItemSalesDetails));
}
/** @internal */
exports.InvoiceItemPurchaseDetails$outboundSchema = z.object({
    unitPrice: z.nullable(z.number()).optional(),
    unitOfMeasure: z.nullable(z.string()).optional(),
    taxInclusive: z.nullable(z.boolean()).optional(),
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        unitPrice: "unit_price",
        unitOfMeasure: "unit_of_measure",
        taxInclusive: "tax_inclusive",
        taxRate: "tax_rate",
    });
});
function invoiceItemPurchaseDetailsToJSON(invoiceItemPurchaseDetails) {
    return JSON.stringify(exports.InvoiceItemPurchaseDetails$outboundSchema.parse(invoiceItemPurchaseDetails));
}
/** @internal */
exports.InvoiceItemInput$outboundSchema = z.object({
    name: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    displayId: z.nullable(z.string()).optional(),
    code: z.nullable(z.string()).optional(),
    sold: z.nullable(z.boolean()).optional(),
    purchased: z.nullable(z.boolean()).optional(),
    tracked: z.nullable(z.boolean()).optional(),
    taxable: z.nullable(z.boolean()).optional(),
    inventoryDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()))
        .optional(),
    type: z.nullable(exports.InvoiceItemTypeType$outboundSchema).optional(),
    salesDetails: z.lazy(() => exports.InvoiceItemSalesDetails$outboundSchema).optional(),
    purchaseDetails: z.lazy(() => exports.InvoiceItemPurchaseDetails$outboundSchema)
        .optional(),
    quantity: z.nullable(z.number()).optional(),
    unitPrice: z.nullable(z.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$outboundSchema).optional(),
    assetAccount: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$outboundSchema).optional(),
    incomeAccount: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$outboundSchema).optional(),
    expenseAccount: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$outboundSchema).optional(),
    trackingCategory: z.nullable(deprecatedlinkedtrackingcategory_js_1.DeprecatedLinkedTrackingCategory$outboundSchema)
        .optional(),
    trackingCategories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$outboundSchema))).optional(),
    active: z.nullable(z.boolean()).optional(),
    departmentId: z.nullable(z.string()).optional(),
    locationId: z.nullable(z.string()).optional(),
    subsidiaryId: z.nullable(z.string()).optional(),
    taxScheduleId: z.nullable(z.string()).optional(),
    rowVersion: z.nullable(z.string()).optional(),
    passThrough: z.array(passthroughbody_js_1.PassThroughBody$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
        inventoryDate: "inventory_date",
        salesDetails: "sales_details",
        purchaseDetails: "purchase_details",
        unitPrice: "unit_price",
        assetAccount: "asset_account",
        incomeAccount: "income_account",
        expenseAccount: "expense_account",
        trackingCategory: "tracking_category",
        trackingCategories: "tracking_categories",
        departmentId: "department_id",
        locationId: "location_id",
        subsidiaryId: "subsidiary_id",
        taxScheduleId: "tax_schedule_id",
        rowVersion: "row_version",
        passThrough: "pass_through",
    });
});
function invoiceItemInputToJSON(invoiceItemInput) {
    return JSON.stringify(exports.InvoiceItemInput$outboundSchema.parse(invoiceItemInput));
}
//# sourceMappingURL=invoiceitem.js.map