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

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

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

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

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

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

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

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

  @Column('numeric', { array: true, transformer: decimalArrayTransformer })
    values!: Decimal[];

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

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

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

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

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

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

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

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

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

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