"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.QuoteLineItemInput$outboundSchema = exports.QuoteLineItem$inboundSchema = exports.QuoteLineItemType$outboundSchema = exports.QuoteLineItemType$inboundSchema = exports.QuoteLineItemType = void 0;
exports.quoteLineItemFromJSON = quoteLineItemFromJSON;
exports.quoteLineItemInputToJSON = quoteLineItemInputToJSON;
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 customfield_js_1 = require("./customfield.js");
const linkedinvoiceitem_js_1 = require("./linkedinvoiceitem.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");
/**
 * Item type
 */
exports.QuoteLineItemType = {
    SalesItem: "sales_item",
    Discount: "discount",
    Info: "info",
    SubTotal: "sub_total",
    Service: "service",
    Other: "other",
};
/** @internal */
exports.QuoteLineItemType$inboundSchema = z.nativeEnum(exports.QuoteLineItemType);
/** @internal */
exports.QuoteLineItemType$outboundSchema = exports.QuoteLineItemType$inboundSchema;
/** @internal */
exports.QuoteLineItem$inboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    row_id: z.string().optional(),
    code: z.nullable(z.string()).optional(),
    line_number: z.nullable(z.number().int()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(exports.QuoteLineItemType$inboundSchema).optional(),
    tax_amount: z.nullable(z.number()).optional(),
    total_amount: z.nullable(z.number()).optional(),
    quantity: z.nullable(z.number()).optional(),
    unit_price: z.nullable(z.number()).optional(),
    unit_of_measure: z.nullable(z.string()).optional(),
    discount_percentage: z.nullable(z.number()).optional(),
    discount_amount: z.nullable(z.number()).optional(),
    service_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v)))
        .optional(),
    category_id: z.nullable(z.string()).optional(),
    location_id: z.nullable(z.string()).optional(),
    department_id: z.nullable(z.string()).optional(),
    item: linkedinvoiceitem_js_1.LinkedInvoiceItem$inboundSchema.optional(),
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$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).optional(),
    custom_fields: z.array(customfield_js_1.CustomField$inboundSchema).optional(),
    row_version: z.nullable(z.string()).optional(),
    updated_by: z.nullable(z.string()).optional(),
    created_by: z.nullable(z.string()).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "row_id": "rowId",
        "line_number": "lineNumber",
        "tax_amount": "taxAmount",
        "total_amount": "totalAmount",
        "unit_price": "unitPrice",
        "unit_of_measure": "unitOfMeasure",
        "discount_percentage": "discountPercentage",
        "discount_amount": "discountAmount",
        "service_date": "serviceDate",
        "category_id": "categoryId",
        "location_id": "locationId",
        "department_id": "departmentId",
        "tax_rate": "taxRate",
        "tracking_categories": "trackingCategories",
        "ledger_account": "ledgerAccount",
        "custom_fields": "customFields",
        "row_version": "rowVersion",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "created_at": "createdAt",
        "updated_at": "updatedAt",
    });
});
function quoteLineItemFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.QuoteLineItem$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'QuoteLineItem' from JSON`);
}
/** @internal */
exports.QuoteLineItemInput$outboundSchema = z.object({
    id: z.nullable(z.string()).optional(),
    rowId: z.string().optional(),
    code: z.nullable(z.string()).optional(),
    lineNumber: z.nullable(z.number().int()).optional(),
    description: z.nullable(z.string()).optional(),
    type: z.nullable(exports.QuoteLineItemType$outboundSchema).optional(),
    taxAmount: z.nullable(z.number()).optional(),
    totalAmount: z.nullable(z.number()).optional(),
    quantity: z.nullable(z.number()).optional(),
    unitPrice: z.nullable(z.number()).optional(),
    unitOfMeasure: z.nullable(z.string()).optional(),
    discountPercentage: z.nullable(z.number()).optional(),
    discountAmount: z.nullable(z.number()).optional(),
    serviceDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString()))
        .optional(),
    categoryId: z.nullable(z.string()).optional(),
    locationId: z.nullable(z.string()).optional(),
    departmentId: z.nullable(z.string()).optional(),
    item: linkedinvoiceitem_js_1.LinkedInvoiceItem$outboundSchema.optional(),
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
    trackingCategories: z.nullable(z.array(z.nullable(linkedtrackingcategory_js_1.LinkedTrackingCategory$outboundSchema))).optional(),
    ledgerAccount: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$outboundSchema).optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).optional(),
    rowVersion: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        rowId: "row_id",
        lineNumber: "line_number",
        taxAmount: "tax_amount",
        totalAmount: "total_amount",
        unitPrice: "unit_price",
        unitOfMeasure: "unit_of_measure",
        discountPercentage: "discount_percentage",
        discountAmount: "discount_amount",
        serviceDate: "service_date",
        categoryId: "category_id",
        locationId: "location_id",
        departmentId: "department_id",
        taxRate: "tax_rate",
        trackingCategories: "tracking_categories",
        ledgerAccount: "ledger_account",
        customFields: "custom_fields",
        rowVersion: "row_version",
    });
});
function quoteLineItemInputToJSON(quoteLineItemInput) {
    return JSON.stringify(exports.QuoteLineItemInput$outboundSchema.parse(quoteLineItemInput));
}
//# sourceMappingURL=quotelineitem.js.map