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

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

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

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

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

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

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

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

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

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