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

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

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

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

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

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

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

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

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

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