"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.BankFeedStatementInput$outboundSchema = exports.BankFeedStatement$inboundSchema = exports.Transactions$outboundSchema = exports.Transactions$inboundSchema = exports.BankFeedStatementTransactionType$outboundSchema = exports.BankFeedStatementTransactionType$inboundSchema = exports.StatementStatus$outboundSchema = exports.StatementStatus$inboundSchema = exports.BankFeedStatementTransactionType = exports.StatementStatus = void 0;
exports.transactionsToJSON = transactionsToJSON;
exports.transactionsFromJSON = transactionsFromJSON;
exports.bankFeedStatementFromJSON = bankFeedStatementFromJSON;
exports.bankFeedStatementInputToJSON = bankFeedStatementInputToJSON;
const z = __importStar(require("zod/v3"));
const primitives_js_1 = require("../../lib/primitives.js");
const schemas_js_1 = require("../../lib/schemas.js");
const creditordebit_js_1 = require("./creditordebit.js");
/**
 * The current status of the bank feed statement.
 */
exports.StatementStatus = {
    Pending: "pending",
    Rejected: "rejected",
    Success: "success",
};
/**
 * Type of transaction.
 */
exports.BankFeedStatementTransactionType = {
    Credit: "credit",
    Debit: "debit",
    Deposit: "deposit",
    Transfer: "transfer",
    Payment: "payment",
    Other: "other",
};
/** @internal */
exports.StatementStatus$inboundSchema = z.nativeEnum(exports.StatementStatus);
/** @internal */
exports.StatementStatus$outboundSchema = exports.StatementStatus$inboundSchema;
/** @internal */
exports.BankFeedStatementTransactionType$inboundSchema = z.nativeEnum(exports.BankFeedStatementTransactionType);
/** @internal */
exports.BankFeedStatementTransactionType$outboundSchema = exports.BankFeedStatementTransactionType$inboundSchema;
/** @internal */
exports.Transactions$inboundSchema = z.object({
    posted_date: z.string().datetime({ offset: true }).transform(v => new Date(v)),
    description: z.string().optional(),
    amount: z.number(),
    credit_or_debit: creditordebit_js_1.CreditOrDebit$inboundSchema,
    source_transaction_id: z.string(),
    counterparty: z.string().optional(),
    reference: z.string().optional(),
    transaction_type: exports.BankFeedStatementTransactionType$inboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "posted_date": "postedDate",
        "credit_or_debit": "creditOrDebit",
        "source_transaction_id": "sourceTransactionId",
        "transaction_type": "transactionType",
    });
});
/** @internal */
exports.Transactions$outboundSchema = z.object({
    postedDate: z.date().transform(v => v.toISOString()),
    description: z.string().optional(),
    amount: z.number(),
    creditOrDebit: creditordebit_js_1.CreditOrDebit$outboundSchema,
    sourceTransactionId: z.string(),
    counterparty: z.string().optional(),
    reference: z.string().optional(),
    transactionType: exports.BankFeedStatementTransactionType$outboundSchema.optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        postedDate: "posted_date",
        creditOrDebit: "credit_or_debit",
        sourceTransactionId: "source_transaction_id",
        transactionType: "transaction_type",
    });
});
function transactionsToJSON(transactions) {
    return JSON.stringify(exports.Transactions$outboundSchema.parse(transactions));
}
function transactionsFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.Transactions$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'Transactions' from JSON`);
}
/** @internal */
exports.BankFeedStatement$inboundSchema = z.object({
    id: z.string(),
    bank_feed_account_id: z.string().optional(),
    status: exports.StatementStatus$inboundSchema.optional(),
    start_date: z.string().datetime({ offset: true }).transform(v => new Date(v))
        .optional(),
    end_date: z.string().datetime({ offset: true }).transform(v => new Date(v))
        .optional(),
    start_balance: z.number().optional(),
    start_balance_credit_or_debit: creditordebit_js_1.CreditOrDebit$inboundSchema.optional(),
    end_balance: z.number().optional(),
    end_balance_credit_or_debit: creditordebit_js_1.CreditOrDebit$inboundSchema.optional(),
    transactions: z.array(z.lazy(() => exports.Transactions$inboundSchema)).optional(),
    created_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    created_by: z.nullable(z.string()).optional(),
    updated_at: z.nullable(z.string().datetime({ offset: true }).transform(v => new Date(v))).optional(),
    updated_by: z.nullable(z.string()).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        "bank_feed_account_id": "bankFeedAccountId",
        "start_date": "startDate",
        "end_date": "endDate",
        "start_balance": "startBalance",
        "start_balance_credit_or_debit": "startBalanceCreditOrDebit",
        "end_balance": "endBalance",
        "end_balance_credit_or_debit": "endBalanceCreditOrDebit",
        "created_at": "createdAt",
        "created_by": "createdBy",
        "updated_at": "updatedAt",
        "updated_by": "updatedBy",
    });
});
function bankFeedStatementFromJSON(jsonString) {
    return (0, schemas_js_1.safeParse)(jsonString, (x) => exports.BankFeedStatement$inboundSchema.parse(JSON.parse(x)), `Failed to parse 'BankFeedStatement' from JSON`);
}
/** @internal */
exports.BankFeedStatementInput$outboundSchema = z.object({
    bankFeedAccountId: z.string().optional(),
    status: exports.StatementStatus$outboundSchema.optional(),
    startDate: z.date().transform(v => v.toISOString()).optional(),
    endDate: z.date().transform(v => v.toISOString()).optional(),
    startBalance: z.number().optional(),
    startBalanceCreditOrDebit: creditordebit_js_1.CreditOrDebit$outboundSchema.optional(),
    endBalance: z.number().optional(),
    endBalanceCreditOrDebit: creditordebit_js_1.CreditOrDebit$outboundSchema.optional(),
    transactions: z.array(z.lazy(() => exports.Transactions$outboundSchema)).optional(),
}).transform((v) => {
    return (0, primitives_js_1.remap)(v, {
        bankFeedAccountId: "bank_feed_account_id",
        startDate: "start_date",
        endDate: "end_date",
        startBalance: "start_balance",
        startBalanceCreditOrDebit: "start_balance_credit_or_debit",
        endBalance: "end_balance",
        endBalanceCreditOrDebit: "end_balance_credit_or_debit",
    });
});
function bankFeedStatementInputToJSON(bankFeedStatementInput) {
    return JSON.stringify(exports.BankFeedStatementInput$outboundSchema.parse(bankFeedStatementInput));
}
//# sourceMappingURL=bankfeedstatement.js.map