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

@Entity('community_goals')
export class CommunityGoal {
  @PrimaryGeneratedColumn('uuid')
  id: string;

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

  @Column('text')
  description: string;

  @Column({ name: 'criteria_type', length: 30 })
  criteriaType: string;

  @Column({ name: 'target_value', type: 'bigint' })
  targetValue: number;

  @Column({ name: 'current_value', type: 'bigint', default: 0 })
  currentValue: number;

  @Column({ name: 'reward_type', length: 30 })
  rewardType: string; // 'xp_boost' | 'loot_boost'

  @Column({ name: 'reward_multiplier', type: 'decimal', precision: 3, scale: 2 })
  rewardMultiplier: number;

  @Column({ name: 'reward_duration_hours' })
  rewardDurationHours: number;

  @Column({ name: 'period_start', type: 'date' })
  periodStart: Date;

  @Column({ name: 'period_end', type: 'date' })
  periodEnd: Date;

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

  @Column({ name: 'completed_at', type: 'timestamp', nullable: true })
  completedAt: Date | null;
}
