//
// Copyright 2021 Vulcanize, Inc.
//

import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
import { decimalTransformer, bigintTransformer } from '@cerc-io/util';
import { Decimal } from 'decimal.js';

@Entity()
@Index(['blockNumber'])
export class ReserveAuction {
  @PrimaryColumn('varchar')
    id!: string;

  @PrimaryColumn('varchar', { length: 66 })
    blockHash!: string;

  @Column('integer')
    blockNumber!: number;

  @Column('varchar')
    pool!: string;

  @Column('numeric', { transformer: decimalTransformer })
    claimableReservesRemaining!: Decimal;

  @Column('numeric', { transformer: decimalTransformer })
    lastTakePrice!: Decimal;

  @Column('numeric', { transformer: bigintTransformer })
    burnEpoch!: bigint;

  @Column('varchar')
    kick!: string;

  @Column('varchar', { array: true })
    takes!: string[];

  @Column('numeric', { transformer: decimalTransformer })
    ajnaBurned!: Decimal;

  @Column('boolean', { default: false })
    isPruned!: boolean;

  @Column('boolean', { default: false })
    isRemoved!: boolean;
}
