import { __decorate, __metadata } from "tslib";
import { AliasHash } from '@polyaztec/barretenberg/account_id';
import { GrumpkinAddress } from '@polyaztec/barretenberg/address';
import { TxId } from '@polyaztec/barretenberg/tx_id';
import { AfterInsert, AfterLoad, AfterUpdate, Column, Entity, Index, PrimaryColumn } from 'typeorm';
import { aliasHashTransformer, grumpkinAddressTransformer, txIdTransformer } from './transformer.js';
let AccountTxDao = class AccountTxDao {
    constructor(init) {
        Object.assign(this, init);
    }
    afterLoad() {
        if (this.settled === null) {
            delete this.settled;
        }
    }
};
__decorate([
    PrimaryColumn('blob', { transformer: [txIdTransformer] }),
    __metadata("design:type", TxId)
], AccountTxDao.prototype, "txId", void 0);
__decorate([
    Index({ unique: false }),
    Column('blob', { transformer: [grumpkinAddressTransformer] }),
    __metadata("design:type", GrumpkinAddress)
], AccountTxDao.prototype, "userId", void 0);
__decorate([
    Column('blob', { nullable: true, transformer: [aliasHashTransformer] }),
    __metadata("design:type", AliasHash)
], AccountTxDao.prototype, "aliasHash", void 0);
__decorate([
    Column({ nullable: true }),
    __metadata("design:type", Buffer)
], AccountTxDao.prototype, "newSpendingPublicKey1", void 0);
__decorate([
    Column({ nullable: true }),
    __metadata("design:type", Buffer)
], AccountTxDao.prototype, "newSpendingPublicKey2", void 0);
__decorate([
    Column(),
    __metadata("design:type", Boolean)
], AccountTxDao.prototype, "migrated", void 0);
__decorate([
    Column(),
    __metadata("design:type", Number)
], AccountTxDao.prototype, "txRefNo", void 0);
__decorate([
    Column(),
    __metadata("design:type", Date)
], AccountTxDao.prototype, "created", void 0);
__decorate([
    Column({ nullable: true }),
    __metadata("design:type", Date)
], AccountTxDao.prototype, "settled", void 0);
__decorate([
    AfterLoad(),
    AfterInsert(),
    AfterUpdate(),
    __metadata("design:type", Function),
    __metadata("design:paramtypes", []),
    __metadata("design:returntype", void 0)
], AccountTxDao.prototype, "afterLoad", null);
AccountTxDao = __decorate([
    Entity({ name: 'accountTx' }),
    __metadata("design:paramtypes", [Object])
], AccountTxD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