"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.FieldsProcessor = void 0;
const shared_1 = require("@taylordb/shared");
class FieldsProcessor {
    process(record) {
        const newRecord = { ...record };
        for (const key in newRecord) {
            const value = newRecord[key];
            if (Array.isArray(value) &&
                value.length > 0 &&
                value[0] instanceof shared_1.Attachment) {
                newRecord[key] = value.map((att) => att.toColumnValue());
            }
            else if (typeof value === 'object' &&
                value !== null &&
                // @ts-ignore
                value instanceof shared_1.Attachment) {
                newRecord[key] = value.toColumnValue();
            }
        }
        return newRecord;
    }
}
exports.FieldsProcessor = FieldsProcessor;
//# sourceMappingURL=fields-processor.js.map