"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.Payment$inboundSchema = void 0;
exports.paymentFromJSON = paymentFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const types = __importStar(require("../../types/primitives.js"));
const allocation_js_1 = require("./allocation.js");
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const deprecatedlinkedsupplier_js_1 = require("./deprecatedlinkedsupplier.js");
const linkedcustomer_js_1 = require("./linkedcustomer.js");
const linkedledgeraccount_js_1 = require("./linkedledgeraccount.js");
const linkedtrackingcategory_js_1 = require("./linkedtrackingcategory.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
const paymentstatus_js_1 = require("./paymentstatus.js");
const paymenttype_js_1 = require("./paymenttype.js");
/** @internal */
exports.Payment$inboundSchema = z.object({
    id: types.string(),
    downstream_id: z.nullable(types.string()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    currency_rate: z.nullable(types.number()).optional(),
    total_amount: types.nullable(types.number()),
    reference: z.nullable(types.string()).optional(),
    payment_method: z.nullable(types.string()).optional(),
    payment_method_reference: z.nullable(types.string()).optional(),
    payment_method_id: z.nullable(types.string()).optional(),
    accounts_receivable_account_type: z.nullable(types.string()).optional(),
    accounts_receivable_account_id: z.nullable(types.string()).optional(),
    account: z.nullable(linkedledgeraccount_js_1.LinkedLedgerAccount$inboundSchema).optional(),
    transaction_date: types.nullable(types.date()),
    customer: z.nullable(linkedcustomer_js_1.LinkedCustomer$inboundSchema).optional(),
    supplier: z.nullable(deprecatedlinkedsupplier_js_1.DeprecatedLinkedSupplier$inboundSchema).optional(),
    company_id: z.nullable(types.string()).optional(),
    reconciled: z.nullable(types.boolean()).optional(),
    status: types.optional(paymentstatus_js_1.PaymentStatus$inboundSchema),
    type: types.optional(paymenttype_js_1.PaymentType$inboundSchema),
    allocations: types.optional(z.array(allocation_js_1.Allocation$inboundSchema)),
    note: 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(),
    custom_fields: types.optional(z.array(customfield_js_1.CustomField$inboundSchema)),
    row_version: z.nullable(types.string()).optional(),
    display_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(),
    created_at: z.nullable(types.date()).optional(),
    updated_at: z.nullable(types.date()).optional(),
    pass_through: types.optional(z.array(passthroughbody_js_1.PassThroughBody$inboundSchema)),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "downstream_id": "downstreamId",
        "currency_rate": "currencyRate",
        "total_amount": "totalAmount",
        "payment_method": "paymentMethod",
        "payment_method_reference": "paymentMethodReference",
        "payment_method_id": "paymentMethodId",
        "accounts_receivable_account_type": "accountsReceivableAccountType",
        "accounts_receivable_account_id": "accountsReceivableAccountId",
        "transaction_date": "transactionDate",
        "company_id": "companyId",
        "tracking_categories": "trackingCategories",
        "custom_fields": "customFields",
        "row_version": "rowVersion",
        "display_id": "displayId",
        "custom_mappings": "customMappings",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "created_at": "createdAt",
        "updated_at": "updatedAt",
        "pass_through": "passThrough",
    });
});
function paymentFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Payment$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Payment' from JSON`);
}
//# sourceMappingURL=payment.js.map