import { Column, Entity, Index, PrimaryColumn } from 'typeorm';

@Index('IDX_payments_prizes_league_season_position_unique', ['leagueId', 'seasonId', 'position'], { unique: true })
@Entity({ name: 'payments_prizes' })
export class PaymentsPrizeOrmEntity {
  @PrimaryColumn({ type: 'text' })
  id!: string;

  @Index()
  @Column({ type: 'text' })
  leagueId!: string;

  @Index()
  @Column({ type: 'text' })
  seasonId!: string;

  @Column({ type: 'int' })
  position!: number;

  @Column({ type: 'text' })
  name!: string;

  @Column({ type: 'double precision' })
  amount!: number;

  @Column({ type: 'text' })
  type!: string;

  @Column({ type: 'text', nullable: true })
  description!: string | null;

  @Column({ type: 'boolean' })
  awarded!: boolean;

  @Column({ type: 'text', nullable: true })
  awardedTo!: string | null;

  @Column({ type: 'timestamptz', nullable: true })
  awardedAt!: Date | null;

  @Column({ type: 'timestamptz' })
  createdAt!: Date;
}
