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

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

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

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

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

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

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

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

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

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

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

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

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

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

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