"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.ProfitAndLoss$inboundSchema = exports.UncategorizedAccounts$inboundSchema = exports.OtherExpenses$inboundSchema = exports.OtherIncome$inboundSchema = exports.Expenses$inboundSchema = exports.CostOfGoodsSold$inboundSchema = exports.Income$inboundSchema = void 0;
exports.incomeFromJSON = incomeFromJSON;
exports.costOfGoodsSoldFromJSON = costOfGoodsSoldFromJSON;
exports.expensesFromJSON = expensesFromJSON;
exports.otherIncomeFromJSON = otherIncomeFromJSON;
exports.otherExpensesFromJSON = otherExpensesFromJSON;
exports.uncategorizedAccountsFromJSON = uncategorizedAccountsFromJSON;
exports.profitAndLossFromJSON = profitAndLossFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const currency_js_1 = require("./currency.js");
const profitandlossindicator_js_1 = require("./profitandlossindicator.js");
const profitandlosstype_js_1 = require("./profitandlosstype.js");
/** @internal */
exports.Income$inboundSchema = z
    .object({
    id: z.string().optional(),
    code: z.string().optional(),
    title: z.string().optional(),
    type: z.nullable(profitandlosstype_js_1.ProfitAndLossType$inboundSchema).optional(),
    total: z.nullable(z.number()),
    records: z.any().optional(),
});
function incomeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Income$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Income' from JSON`);
}
/** @internal */
exports.CostOfGoodsSold$inboundSchema = z.object({
    id: z.string().optional(),
    code: z.string().optional(),
    title: z.string().optional(),
    type: z.nullable(profitandlosstype_js_1.ProfitAndLossType$inboundSchema).optional(),
    total: z.nullable(z.number()).optional(),
    records: z.any().optional(),
});
function costOfGoodsSoldFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.CostOfGoodsSold$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'CostOfGoodsSold' from JSON`);
}
/** @internal */
exports.Expenses$inboundSchema = z.object({
    id: z.string().optional(),
    code: z.string().optional(),
    title: z.string().optional(),
    type: z.nullable(profitandlosstype_js_1.ProfitAndLossType$inboundSchema).optional(),
    total: z.nullable(z.number()),
    records: z.any().optional(),
});
function expensesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Expenses$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Expenses' from JSON`);
}
/** @internal */
exports.OtherIncome$inboundSchema = z.object({
    id: z.string().optional(),
    code: z.string().optional(),
    title: z.string().optional(),
    type: z.nullable(profitandlosstype_js_1.ProfitAndLossType$inboundSchema).optional(),
    total: z.nullable(z.number()).optional(),
    records: z.any().optional(),
});
function otherIncomeFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OtherIncome$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OtherIncome' from JSON`);
}
/** @internal */
exports.OtherExpenses$inboundSchema = z.object({
    id: z.string().optional(),
    code: z.string().optional(),
    title: z.string().optional(),
    type: z.nullable(profitandlosstype_js_1.ProfitAndLossType$inboundSchema).optional(),
    total: z.nullable(z.number()).optional(),
    records: z.any().optional(),
});
function otherExpensesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.OtherExpenses$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'OtherExpenses' from JSON`);
}
/** @internal */
exports.UncategorizedAccounts$inboundSchema = z.object({
    id: z.string().optional(),
    code: z.string().optional(),
    title: z.string().optional(),
    type: z.nullable(profitandlosstype_js_1.ProfitAndLossType$inboundSchema).optional(),
    total: z.nullable(z.number()),
    records: z.any().optional(),
});
function uncategorizedAccountsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.UncategorizedAccounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'UncategorizedAccounts' from JSON`);
}
/** @internal */
exports.ProfitAndLoss$inboundSchema = z.object({
    id: z.string().optional(),
    report_name: z.string(),
    start_date: z.string().optional(),
    end_date: z.string().optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    income: z.lazy(() => exports.Income$inboundSchema),
    cost_of_goods_sold: z.lazy(() => exports.CostOfGoodsSold$inboundSchema).optional(),
    expenses: z.lazy(() => exports.Expenses$inboundSchema),
    other_income: z.lazy(() => exports.OtherIncome$inboundSchema).optional(),
    other_expenses: z.lazy(() => exports.OtherExpenses$inboundSchema).optional(),
    uncategorized_accounts: z.lazy(() => exports.UncategorizedAccounts$inboundSchema)
        .optional(),
    gross_profit: profitandlossindicator_js_1.ProfitAndLossIndicator$inboundSchema.optional(),
    net_operating_income: profitandlossindicator_js_1.ProfitAndLossIndicator$inboundSchema.optional(),
    net_income: profitandlossindicator_js_1.ProfitAndLossIndicator$inboundSchema.optional(),
    custom_mappings: z.nullable(z.record(z.any())).optional(),
    customer: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "report_name": "reportName",
        "start_date": "startDate",
        "end_date": "endDate",
        "cost_of_goods_sold": "costOfGoodsSold",
        "other_income": "otherIncome",
        "other_expenses": "otherExpenses",
        "uncategorized_accounts": "uncategorizedAccounts",
        "gross_profit": "grossProfit",
        "net_operating_income": "netOperatingIncome",
        "net_income": "netIncome",
        "custom_mappings": "customMappings",
    });
});
function profitAndLossFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ProfitAndLoss$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ProfitAndLoss' from JSON`);
}
//# sourceMappingURL=profitandloss.js.map