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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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