import {
  Entity,
  PrimaryGeneratedColumn,
  Column,
} from 'typeorm';

@Entity('achievements')
export class Achievement {
  @PrimaryGeneratedColumn('uuid')
  id: string;

  @Column({ length: 50, unique: true })
  key: string;

  @Column({ length: 100 })
  name: string;

  @Column('text')
  description: string;

  @Column({ length: 20 })
  category: string; // 'progression' | 'combat' | 'zones' | 'equipment' | 'economy'

  @Column({ length: 10 })
  tier: string; // 'bronze' | 'silver' | 'gold'

  @Column({ name: 'criteria_type', length: 30 })
  criteriaType: string; // 'combat_wins' | 'level_reached' | 'gold_accumulated' | ...

  @Column({ name: 'criteria_value' })
  criteriaValue: number;

  @Column({ name: 'reward_gold', default: 0 })
  rewardGold: number;

  @Column({ type: 'varchar', name: 'reward_title', length: 100, nullable: true })
  rewardTitle: string | null;
}
