import { Entity, PrimaryGeneratedColumn, Column, OneToMany } from "typeorm";
import { ContestEntry } from "./ContestEntry";
import { ContestVote } from "./ContestVote";

@Entity()
export class Contest {

    @PrimaryGeneratedColumn()
    id: number;

    @Column()
    startDate: Date;

    @Column()
    endDate: Date;

    @Column()
    channel: string;

    @Column()
    announceWinners: boolean;

    @Column()
    voteReaction: string;

    @Column({ default: 1 })
    maxWinners: number;

    @Column({ default: true })
    uniqueWinners: boolean;

    @Column({ default: false })
    active: boolean;

    // @OneToMany(type => ContestEntry, entry => entry.contest)
    @OneToMany("ContestEntry", "contest")
    entries: ContestEntry[];

    // @OneToMany(type => ContestVote, vote => vote.contest)
    @OneToMany("ContestVote", "contest")
    votes: ContestVote[];
}