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

import { Entity, PrimaryColumn, Column, Index } from 'typeorm';
import { bigintTransformer } from '@cerc-io/util';

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

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

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

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

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

  @Column('integer', { nullable: true })
    decimals!: number | null;

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

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

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

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

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

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

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