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

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

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

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

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

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

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

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

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

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

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

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

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