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

@Entity({ name: 'user_achievements' })
@Index(['userId', 'achievementId'], { unique: true })
export class UserAchievementOrmEntity {
  @PrimaryColumn({ type: 'uuid' })
  id!: string;

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

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

  @Column({ type: 'int', default: 100 })
  progress!: number;

  @CreateDateColumn({ type: 'timestamptz' })
  earnedAt!: Date;

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