//
// 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 Burn {
  @PrimaryColumn('varchar')
    id!: string;

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

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

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

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

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

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

  @Column('varchar', { nullable: true })
    sender!: string | null;

  @Column('numeric', { nullable: true, transformer: decimalTransformer })
    amount0!: Decimal | null;

  @Column('numeric', { nullable: true, transformer: decimalTransformer })
    amount1!: Decimal | null;

  @Column('varchar', { nullable: true })
    to!: string | null;

  @Column('numeric', { nullable: true, transformer: bigintTransformer })
    logIndex!: bigint | null;

  @Column('numeric', { nullable: true, transformer: decimalTransformer })
    amountUSD!: Decimal | null;

  @Column('boolean')
    needsComplete!: boolean;

  @Column('varchar', { nullable: true })
    feeTo!: string | null;

  @Column('numeric', { nullable: true, transformer: decimalTransformer })
    feeLiquidity!: Decimal | null;

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

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