"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.AccountingJournalResult$ = exports.AccountingJournalResult$outboundSchema = exports.AccountingJournalResult$inboundSchema = exports.AccountingJournalResultData$ = exports.AccountingJournalResultData$outboundSchema = exports.AccountingJournalResultData$inboundSchema = exports.AccountingJournalResultStatus$ = exports.AccountingJournalResultStatus$outboundSchema = exports.AccountingJournalResultStatus$inboundSchema = exports.AccountingJournalResultValue$ = exports.AccountingJournalResultValue$outboundSchema = exports.AccountingJournalResultValue$inboundSchema = exports.AccountingJournalResultSourceValue$ = exports.AccountingJournalResultSourceValue$outboundSchema = exports.AccountingJournalResultSourceValue$inboundSchema = exports.AccountingJournalResult4$ = exports.AccountingJournalResult4$outboundSchema = exports.AccountingJournalResult4$inboundSchema = exports.AccountingJournalResultValue = void 0;
exports.accountingJournalResult4ToJSON = accountingJournalResult4ToJSON;
exports.accountingJournalResult4FromJSON = accountingJournalResult4FromJSON;
exports.accountingJournalResultSourceValueToJSON = accountingJournalResultSourceValueToJSON;
exports.accountingJournalResultSourceValueFromJSON = accountingJournalResultSourceValueFromJSON;
exports.accountingJournalResultStatusToJSON = accountingJournalResultStatusToJSON;
exports.accountingJournalResultStatusFromJSON = accountingJournalResultStatusFromJSON;
exports.accountingJournalResultDataToJSON = accountingJournalResultDataToJSON;
exports.accountingJournalResultDataFromJSON = accountingJournalResultDataFromJSON;
exports.accountingJournalResultToJSON = accountingJournalResultToJSON;
exports.accountingJournalResultFromJSON = accountingJournalResultFromJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../../lib/primitives.js");
const schemas_js_1 = require("../../../lib/schemas.js");
const enums_js_1 = require("../../types/enums.js");
const journalline_js_1 = require("./journalline.js");
const rawresponse_js_1 = require("./rawresponse.js");
/**
 * The journal status
 */
var AccountingJournalResultValue;
(function (AccountingJournalResultValue) {
    AccountingJournalResultValue["Draft"] = "draft";
    AccountingJournalResultValue["Posted"] = "posted";
    AccountingJournalResultValue["Void"] = "void";
    AccountingJournalResultValue["UnmappedValue"] = "unmapped_value";
})(AccountingJournalResultValue || (exports.AccountingJournalResultValue = AccountingJournalResultValue = {}));
/** @internal */
exports.AccountingJournalResult4$inboundSchema = z.object({});
/** @internal */
exports.AccountingJournalResult4$outboundSchema = z.object({});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var AccountingJournalResult4$;
(function (AccountingJournalResult4$) {
    /** @deprecated use `AccountingJournalResult4$inboundSchema` instead. */
    AccountingJournalResult4$.inboundSchema = exports.AccountingJournalResult4$inboundSchema;
    /** @deprecated use `AccountingJournalResult4$outboundSchema` instead. */
    AccountingJournalResult4$.outboundSchema = exports.AccountingJournalResult4$outboundSchema;
})(AccountingJournalResult4$ || (exports.AccountingJournalResult4$ = AccountingJournalResult4$ = {}));
function accountingJournalResult4ToJSON(accountingJournalResult4) {
    return JSON.stringify(exports.AccountingJournalResult4$outboundSchema.parse(accountingJournalResult4));
}
function accountingJournalResult4FromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AccountingJournalResult4$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalResult4' from JSON`);
}
/** @internal */
exports.AccountingJournalResultSourceValue$inboundSchema = z.union([
    z.string(),
    z.number(),
    z.boolean(),
    z.lazy(() => exports.AccountingJournalResult4$inboundSchema),
    z.array(z.any()),
]);
/** @internal */
exports.AccountingJournalResultSourceValue$outboundSchema = z.union([
    z.string(),
    z.number(),
    z.boolean(),
    z.lazy(() => exports.AccountingJournalResult4$outboundSchema),
    z.array(z.any()),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var AccountingJournalResultSourceValue$;
(function (AccountingJournalResultSourceValue$) {
    /** @deprecated use `AccountingJournalResultSourceValue$inboundSchema` instead. */
    AccountingJournalResultSourceValue$.inboundSchema = exports.AccountingJournalResultSourceValue$inboundSchema;
    /** @deprecated use `AccountingJournalResultSourceValue$outboundSchema` instead. */
    AccountingJournalResultSourceValue$.outboundSchema = exports.AccountingJournalResultSourceValue$outboundSchema;
})(AccountingJournalResultSourceValue$ || (exports.AccountingJournalResultSourceValue$ = AccountingJournalResultSourceValue$ = {}));
function accountingJournalResultSourceValueToJSON(accountingJournalResultSourceValue) {
    return JSON.stringify(exports.AccountingJournalResultSourceValue$outboundSchema.parse(accountingJournalResultSourceValue));
}
function accountingJournalResultSourceValueFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AccountingJournalResultSourceValue$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalResultSourceValue' from JSON`);
}
/** @internal */
exports.AccountingJournalResultValue$inboundSchema = z
    .union([
    z.nativeEnum(AccountingJournalResultValue),
    z.string().transform(enums_js_1.catchUnrecognizedEnum),
]);
/** @internal */
exports.AccountingJournalResultValue$outboundSchema = z.union([
    z.nativeEnum(AccountingJournalResultValue),
    z.string().and(z.custom()),
]);
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var AccountingJournalResultValue$;
(function (AccountingJournalResultValue$) {
    /** @deprecated use `AccountingJournalResultValue$inboundSchema` instead. */
    AccountingJournalResultValue$.inboundSchema = exports.AccountingJournalResultValue$inboundSchema;
    /** @deprecated use `AccountingJournalResultValue$outboundSchema` instead. */
    AccountingJournalResultValue$.outboundSchema = exports.AccountingJournalResultValue$outboundSchema;
})(AccountingJournalResultValue$ || (exports.AccountingJournalResultValue$ = AccountingJournalResultValue$ = {}));
/** @internal */
exports.AccountingJournalResultStatus$inboundSchema = z.object({
    source_value: z.nullable(z.union([
        z.string(),
        z.number(),
        z.boolean(),
        z.lazy(() => exports.AccountingJournalResult4$inboundSchema),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.AccountingJournalResultValue$inboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "source_value": "sourceValue",
    });
});
/** @internal */
exports.AccountingJournalResultStatus$outboundSchema = z.object({
    sourceValue: z.nullable(z.union([
        z.string(),
        z.number(),
        z.boolean(),
        z.lazy(() => exports.AccountingJournalResult4$outboundSchema),
        z.array(z.any()),
    ])).optional(),
    value: z.nullable(exports.AccountingJournalResultValue$outboundSchema).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        sourceValue: "source_value",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var AccountingJournalResultStatus$;
(function (AccountingJournalResultStatus$) {
    /** @deprecated use `AccountingJournalResultStatus$inboundSchema` instead. */
    AccountingJournalResultStatus$.inboundSchema = exports.AccountingJournalResultStatus$inboundSchema;
    /** @deprecated use `AccountingJournalResultStatus$outboundSchema` instead. */
    AccountingJournalResultStatus$.outboundSchema = exports.AccountingJournalResultStatus$outboundSchema;
})(AccountingJournalResultStatus$ || (exports.AccountingJournalResultStatus$ = AccountingJournalResultStatus$ = {}));
function accountingJournalResultStatusToJSON(accountingJournalResultStatus) {
    return JSON.stringify(exports.AccountingJournalResultStatus$outboundSchema.parse(accountingJournalResultStatus));
}
function accountingJournalResultStatusFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AccountingJournalResultStatus$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalResultStatus' from JSON`);
}
/** @internal */
exports.AccountingJournalResultData$inboundSchema = z.object({
    company_id: z.nullable(z.string()).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    id: z.nullable(z.string()).optional(),
    lines: z.nullable(z.array(journalline_js_1.JournalLine$inboundSchema)).optional(),
    memo: z.nullable(z.string()).optional(),
    posted_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    reference: z.nullable(z.string()).optional(),
    remote_id: z.nullable(z.string()).optional(),
    status: z.nullable(z.lazy(() => exports.AccountingJournalResultStatus$inboundSchema))
        .optional(),
    transaction_date: 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, {
        "company_id": "companyId",
        "created_at": "createdAt",
        "posted_at": "postedAt",
        "remote_id": "remoteId",
        "transaction_date": "transactionDate",
        "updated_at": "updatedAt",
    });
});
/** @internal */
exports.AccountingJournalResultData$outboundSchema = z.object({
    companyId: z.nullable(z.string()).optional(),
    createdAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    id: z.nullable(z.string()).optional(),
    lines: z.nullable(z.array(journalline_js_1.JournalLine$outboundSchema)).optional(),
    memo: z.nullable(z.string()).optional(),
    postedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
    reference: z.nullable(z.string()).optional(),
    remoteId: z.nullable(z.string()).optional(),
    status: z.nullable(z.lazy(() => exports.AccountingJournalResultStatus$outboundSchema))
        .optional(),
    transactionDate: z.nullable(z.date().transform(v => v.toISOString()))
        .optional(),
    updatedAt: z.nullable(z.date().transform(v => v.toISOString())).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        companyId: "company_id",
        createdAt: "created_at",
        postedAt: "posted_at",
        remoteId: "remote_id",
        transactionDate: "transaction_date",
        updatedAt: "updated_at",
    });
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var AccountingJournalResultData$;
(function (AccountingJournalResultData$) {
    /** @deprecated use `AccountingJournalResultData$inboundSchema` instead. */
    AccountingJournalResultData$.inboundSchema = exports.AccountingJournalResultData$inboundSchema;
    /** @deprecated use `AccountingJournalResultData$outboundSchema` instead. */
    AccountingJournalResultData$.outboundSchema = exports.AccountingJournalResultData$outboundSchema;
})(AccountingJournalResultData$ || (exports.AccountingJournalResultData$ = AccountingJournalResultData$ = {}));
function accountingJournalResultDataToJSON(accountingJournalResultData) {
    return JSON.stringify(exports.AccountingJournalResultData$outboundSchema.parse(accountingJournalResultData));
}
function accountingJournalResultDataFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AccountingJournalResultData$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalResultData' from JSON`);
}
/** @internal */
exports.AccountingJournalResult$inboundSchema = z.object({
    data: z.nullable(z.lazy(() => exports.AccountingJournalResultData$inboundSchema))
        .optional(),
    raw: z.nullable(z.array(rawresponse_js_1.RawResponse$inboundSchema)).optional(),
});
/** @internal */
exports.AccountingJournalResult$outboundSchema = z.object({
    data: z.nullable(z.lazy(() => exports.AccountingJournalResultData$outboundSchema))
        .optional(),
    raw: z.nullable(z.array(rawresponse_js_1.RawResponse$outboundSchema)).optional(),
});
/**
 * @internal
 * @deprecated This namespace will be removed in future versions. Use schemas and types that are exported directly from this module.
 */
var AccountingJournalResult$;
(function (AccountingJournalResult$) {
    /** @deprecated use `AccountingJournalResult$inboundSchema` instead. */
    AccountingJournalResult$.inboundSchema = exports.AccountingJournalResult$inboundSchema;
    /** @deprecated use `AccountingJournalResult$outboundSchema` instead. */
    AccountingJournalResult$.outboundSchema = exports.AccountingJournalResult$outboundSchema;
})(AccountingJournalResult$ || (exports.AccountingJournalResult$ = AccountingJournalResult$ = {}));
function accountingJournalResultToJSON(accountingJournalResult) {
    return JSON.stringify(exports.AccountingJournalResult$outboundSchema.parse(accountingJournalResult));
}
function accountingJournalResultFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.AccountingJournalResult$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'AccountingJournalResult' from JSON`);
}
//# sourceMappingURL=accountingjournalresult.js.map