"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.LedgerAccountInput$outboundSchema = exports.LedgerAccount$inboundSchema = exports.LedgerAccountSubsidiaries$outboundSchema = exports.LedgerAccountSubsidiaries$inboundSchema = exports.SubAccounts$inboundSchema = exports.ParentAccount$outboundSchema = exports.ParentAccount$inboundSchema = exports.Categories$inboundSchema = exports.AccountStatus$outboundSchema = exports.AccountStatus$inboundSchema = exports.LedgerAccountType$outboundSchema = exports.LedgerAccountType$inboundSchema = exports.LedgerAccountClassification$outboundSchema = exports.LedgerAccountClassification$inboundSchema = exports.AccountStatus = exports.LedgerAccountType = exports.LedgerAccountClassification = void 0;
exports.categoriesFromJSON = categoriesFromJSON;
exports.parentAccountToJSON = parentAccountToJSON;
exports.parentAccountFromJSON = parentAccountFromJSON;
exports.subAccountsFromJSON = subAccountsFromJSON;
exports.ledgerAccountSubsidiariesToJSON = ledgerAccountSubsidiariesToJSON;
exports.ledgerAccountSubsidiariesFromJSON = ledgerAccountSubsidiariesFromJSON;
exports.ledgerAccountFromJSON = ledgerAccountFromJSON;
exports.ledgerAccountInputToJSON = ledgerAccountInputToJSON;
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 bankaccount_js_1 = require("./bankaccount.js");
const currency_js_1 = require("./currency.js");
const customfield_js_1 = require("./customfield.js");
const linkedtaxrate_js_1 = require("./linkedtaxrate.js");
const linkedtaxrateinput_js_1 = require("./linkedtaxrateinput.js");
const passthroughbody_js_1 = require("./passthroughbody.js");
/**
 * The classification of account.
 */
exports.LedgerAccountClassification = {
    Asset: "asset",
    Equity: "equity",
    Expense: "expense",
    Liability: "liability",
    Revenue: "revenue",
    Income: "income",
    OtherIncome: "other_income",
    OtherExpense: "other_expense",
    CostsOfSales: "costs_of_sales",
    Other: "other",
};
/**
 * The type of account.
 */
exports.LedgerAccountType = {
    AccountsPayable: "accounts_payable",
    AccountsReceivable: "accounts_receivable",
    Balancesheet: "balancesheet",
    Bank: "bank",
    CostsOfSales: "costs_of_sales",
    CreditCard: "credit_card",
    CurrentAsset: "current_asset",
    CurrentLiability: "current_liability",
    Equity: "equity",
    Expense: "expense",
    FixedAsset: "fixed_asset",
    NonCurrentAsset: "non_current_asset",
    NonCurrentLiability: "non_current_liability",
    OtherAsset: "other_asset",
    OtherExpense: "other_expense",
    OtherIncome: "other_income",
    OtherLiability: "other_liability",
    Revenue: "revenue",
    Sales: "sales",
    Other: "other",
};
/**
 * The status of the account.
 */
exports.AccountStatus = {
    Active: "active",
    Inactive: "inactive",
    Archived: "archived",
};
/** @internal */
exports.LedgerAccountClassification$inboundSchema = z.nativeEnum(exports.LedgerAccountClassification);
/** @internal */
exports.LedgerAccountClassification$outboundSchema = exports.LedgerAccountClassification$inboundSchema;
/** @internal */
exports.LedgerAccountType$inboundSchema = z.nativeEnum(exports.LedgerAccountType);
/** @internal */
exports.LedgerAccountType$outboundSchema = exports.LedgerAccountType$inboundSchema;
/** @internal */
exports.AccountStatus$inboundSchema = z.nativeEnum(exports.AccountStatus);
/** @internal */
exports.AccountStatus$outboundSchema = exports.AccountStatus$inboundSchema;
/** @internal */
exports.Categories$inboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
});
function categoriesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Categories$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Categories' from JSON`);
}
/** @internal */
exports.ParentAccount$inboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
    display_id: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "display_id": "displayId",
    });
});
/** @internal */
exports.ParentAccount$outboundSchema = z.object({
    id: z.string().optional(),
    name: z.string().optional(),
    displayId: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        displayId: "display_id",
    });
});
function parentAccountToJSON(parentAccount) {
    return JSON.stringify(exports.ParentAccount$outboundSchema.parse(parentAccount));
}
function parentAccountFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.ParentAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'ParentAccount' from JSON`);
}
/** @internal */
exports.SubAccounts$inboundSchema = z.object({
    id: z.string().optional(),
    account_sub_name: z.string().optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "account_sub_name": "accountSubName",
    });
});
function subAccountsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.SubAccounts$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'SubAccounts' from JSON`);
}
/** @internal */
exports.LedgerAccountSubsidiaries$inboundSchema = z.object({
    id: z.string().optional(),
});
/** @internal */
exports.LedgerAccountSubsidiaries$outboundSchema = z.object({
    id: z.string().optional(),
});
function ledgerAccountSubsidiariesToJSON(ledgerAccountSubsidiaries) {
    return JSON.stringify(exports.LedgerAccountSubsidiaries$outboundSchema.parse(ledgerAccountSubsidiaries));
}
function ledgerAccountSubsidiariesFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.LedgerAccountSubsidiaries$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LedgerAccountSubsidiaries' from JSON`);
}
/** @internal */
exports.LedgerAccount$inboundSchema = z.object({
    id: z.string().optional(),
    display_id: z.string().optional(),
    nominal_code: z.nullable(z.string()).optional(),
    code: z.nullable(z.string()).optional(),
    classification: z.nullable(exports.LedgerAccountClassification$inboundSchema)
        .optional(),
    type: exports.LedgerAccountType$inboundSchema.optional(),
    sub_type: z.nullable(z.string()).optional(),
    name: z.nullable(z.string()).optional(),
    fully_qualified_name: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    opening_balance: z.nullable(z.number()).optional(),
    current_balance: z.nullable(z.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$inboundSchema).optional(),
    tax_type: z.nullable(z.string()).optional(),
    tax_rate: linkedtaxrate_js_1.LinkedTaxRate$inboundSchema.optional(),
    level: z.nullable(z.number()).optional(),
    active: z.nullable(z.boolean()).optional(),
    status: z.nullable(exports.AccountStatus$inboundSchema).optional(),
    header: z.nullable(z.boolean()).optional(),
    bank_account: bankaccount_js_1.BankAccount$inboundSchema.optional(),
    categories: z.array(z.lazy(() => exports.Categories$inboundSchema)).optional(),
    parent_account: z.lazy(() => exports.ParentAccount$inboundSchema).optional(),
    sub_account: z.nullable(z.boolean()).optional(),
    sub_accounts: z.array(z.lazy(() => exports.SubAccounts$inboundSchema)).optional(),
    last_reconciliation_date: z.nullable(z.string().transform(v => new rfcdate_js_1.RFCDate(v))).optional(),
    subsidiaries: z.array(z.lazy(() => exports.LedgerAccountSubsidiaries$inboundSchema))
        .optional(),
    custom_mappings: z.nullable(z.record(z.any())).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(),
    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",
        "nominal_code": "nominalCode",
        "sub_type": "subType",
        "fully_qualified_name": "fullyQualifiedName",
        "opening_balance": "openingBalance",
        "current_balance": "currentBalance",
        "tax_type": "taxType",
        "tax_rate": "taxRate",
        "bank_account": "bankAccount",
        "parent_account": "parentAccount",
        "sub_account": "subAccount",
        "sub_accounts": "subAccounts",
        "last_reconciliation_date": "lastReconciliationDate",
        "custom_mappings": "customMappings",
        "custom_fields": "customFields",
        "row_version": "rowVersion",
        "updated_by": "updatedBy",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "created_at": "createdAt",
        "pass_through": "passThrough",
    });
});
function ledgerAccountFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.LedgerAccount$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'LedgerAccount' from JSON`);
}
/** @internal */
exports.LedgerAccountInput$outboundSchema = z.object({
    displayId: z.string().optional(),
    nominalCode: z.nullable(z.string()).optional(),
    code: z.nullable(z.string()).optional(),
    classification: z.nullable(exports.LedgerAccountClassification$outboundSchema)
        .optional(),
    type: exports.LedgerAccountType$outboundSchema.optional(),
    subType: z.nullable(z.string()).optional(),
    name: z.nullable(z.string()).optional(),
    fullyQualifiedName: z.nullable(z.string()).optional(),
    description: z.nullable(z.string()).optional(),
    openingBalance: z.nullable(z.number()).optional(),
    currentBalance: z.nullable(z.number()).optional(),
    currency: z.nullable(currency_js_1.Currency$outboundSchema).optional(),
    taxType: z.nullable(z.string()).optional(),
    taxRate: linkedtaxrateinput_js_1.LinkedTaxRateInput$outboundSchema.optional(),
    level: z.nullable(z.number()).optional(),
    active: z.nullable(z.boolean()).optional(),
    status: z.nullable(exports.AccountStatus$outboundSchema).optional(),
    header: z.nullable(z.boolean()).optional(),
    bankAccount: bankaccount_js_1.BankAccount$outboundSchema.optional(),
    parentAccount: z.lazy(() => exports.ParentAccount$outboundSchema).optional(),
    subAccount: z.nullable(z.boolean()).optional(),
    lastReconciliationDate: z.nullable(z.instanceof(rfcdate_js_1.RFCDate).transform(v => v.toString())).optional(),
    subsidiaries: z.array(z.lazy(() => exports.LedgerAccountSubsidiaries$outboundSchema))
        .optional(),
    customFields: z.array(customfield_js_1.CustomField$outboundSchema).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",
        nominalCode: "nominal_code",
        subType: "sub_type",
        fullyQualifiedName: "fully_qualified_name",
        openingBalance: "opening_balance",
        currentBalance: "current_balance",
        taxType: "tax_type",
        taxRate: "tax_rate",
        bankAccount: "bank_account",
        parentAccount: "parent_account",
        subAccount: "sub_account",
        lastReconciliationDate: "last_reconciliation_date",
        customFields: "custom_fields",
        rowVersion: "row_version",
        passThrough: "pass_through",
    });
});
function ledgerAccountInputToJSON(ledgerAccountInput) {
    return JSON.stringify(exports.LedgerAccountInput$outboundSchema.parse(ledgerAccountInput));
}
//# sourceMappingURL=ledgeraccount.js.map