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

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

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

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

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

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

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

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

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

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

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

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

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

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

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