import { __decorate, __metadata } from "tslib";
import { GrumpkinAddress } from '@polyaztec/barretenberg/address';
import { TxId } from '@polyaztec/barretenberg/tx_id';
import { AfterInsert, AfterLoad, AfterUpdate, Column, Entity, Index, PrimaryColumn } from 'typeorm';
import { bigintTransformer, ethAddressTransformer, grumpkinAddressTransformer, txIdTransformer, } from './transformer.js';
let PaymentTxDao = class PaymentTxDao {
    constructor(init) {
        Object.assign(this, init);
    }
    afterLoad() {
        if (this.settled === null) {
            delete this.settled;
        }
    }
};
__decorate([
    PrimaryColumn('blob', { transformer: [txIdTransformer] }),
    __metadata("design:type", TxId)
], PaymentTxDao.prototype, "txId", void 0);
__decorate([
    PrimaryColumn('blob', { transformer: [grumpkinAddressTransformer] }),
    __metadata("design:type", GrumpkinAddress)
], PaymentTxDao.prototype, "userId", void 0);
__decorate([
    Column(),
    __metadata("design:type", Number)
], PaymentTxDao.prototype, "proofId", void 0);
__decorate([
    Column(),
    __metadata("design:type", Number)
], PaymentTxDao.prototype, "assetId", void 0);
__decorate([
    Column('text', { transformer: [bigintTransformer] }),
    __metadata("design:type", typeof BigInt === "function" ? BigInt : Object)
], PaymentTxDao.prototype, "publicValue", void 0);
__decorate([
    Column('blob', { transformer: [ethAddressTransformer], nullable: true }),
    __metadata("design:type", Object)
], PaymentTxDao.prototype, "publicOwner", void 0);
__decorate([
    Column('text', { transformer: [bigintTransformer] }),
    __metadata("design:type", typeof BigInt === "function" ? BigInt : Object)
], PaymentTxDao.prototype, "privateInput", void 0);
__decorate([
    Column('text', { transformer: [bigintTransformer] }),
    __metadata("design:type", typeof BigInt === "function" ? BigInt : Object)
], PaymentTxDao.prototype, "recipientPrivateOutput", void 0);
__decorate([
    Column('text', { transformer: [bigintTransformer] }),
    __metadata("design:type", typeof BigInt === "function" ? BigInt : Object)
], PaymentTxDao.prototype, "senderPrivateOutput", void 0);
__decorate([
    Column(),
    __metadata("design:type", Boolean)
], PaymentTxDao.prototype, "isRecipient", void 0);
__decorate([
    Column(),
    __metadata("design:type", Boolean)
], PaymentTxDao.prototype, "isSender", void 0);
__decorate([
    Column(),
    __metadata("design:type", Number)
], PaymentTxDao.prototype, "txRefNo", void 0);
__decorate([
    Column(),
    __metadata("design:type", Date)
], PaymentTxDao.prototype, "created", void 0);
__decorate([
    Column({ nullable: true }),
    __metadata("design:type", Date)
], PaymentTxDao.prototype, "settled", void 0);
__decorate([
    AfterLoad(),
    AfterInsert(),
    AfterUpdate(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], PaymentTxDao.prototype, "afterLoad", null);
PaymentTxDao = __decorate([
    Entity({ name: 'paymentTx' }),
    Index(['txId', 'userId'], { unique: true }),
    __metadata("design:paramtypes", [Object])
], PaymentTxDao);
export { PaymentTxDao };
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGF5bWVudF90eF9kYW8uanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvZGF0YWJhc2Uvbm9kZS9wYXltZW50X3R4X2Rhby50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUEsT0FBTyxFQUFjLGVBQWUsRUFBRSxNQUFNLGlDQUFpQyxDQUFDO0FBQzlFLE9BQU8sRUFBRSxJQUFJLEVBQUUsTUFBTSwrQkFBK0IsQ0FBQztBQUNyRCxPQUFPLEVBQUUsV0FBVyxFQUFFLFNBQVMsRUFBRSxXQUFXLEVBQUUsTUFBTSxFQUFFLE1BQU0sRUFBRSxLQUFLLEVBQUUsYUFBYSxFQUFFLE1BQU0sU0FBUyxDQUFDO0FBRXBHLE9BQU8sRUFDTCxpQkFBaUIsRUFDakIscUJBQXFCLEVBQ3JCLDBCQUEwQixFQUMxQixlQUFlLEdBQ2hCLE1BQU0sa0JBQWtCLENBQUM7QUFJMUIsSUFBYSxZQUFZLEdBQXpCLE1BQWEsWUFBWTtJQUN2QixZQUFtQixJQUE0QjtRQUM3QyxNQU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