import 'reflect-metadata';
import { DataSource } from 'typeorm';
import { User } from '../user/user.entity';
import { Character } from '../character/entities/character.entity';
import { LevelThreshold } from '../character/entities/level-threshold.entity';
import { CombatLog } from '../combat/combat-log.entity';
import { Item } from '../item/item.entity';
import { CharacterItem } from '../item/character-item.entity';
import { Material } from '../material/material.entity';
import { CharacterMaterial } from '../material/character-material.entity';
import { Transaction } from '../economy/entities/transaction.entity';
import { TetardCoin } from '../economy/entities/tetard-coin.entity';
import { ProcessedEvent } from '../twitch/entities/processed-event.entity';
import { Recipe } from '../craft/recipe.entity';
import { CraftJob } from '../craft/craft-job.entity';
import { Monster } from '../monster/monster.entity';
import { Achievement } from '../achievement/achievement.entity';
import { PlayerAchievement } from '../achievement/player-achievement.entity';
import { CommunityGoal } from '../community/community-goal.entity';
import { CommunityContribution } from '../community/community-contribution.entity';
import { ActiveBoost } from '../community/active-boost.entity';
import { HallOfFame } from '../halloffame/hall-of-fame.entity';

// DataSource pour le CLI TypeORM (migrations manuelles)
export const AppDataSource = new DataSource({
  type: 'mysql',
  url: process.env.DATABASE_URL ?? 'mysql://tetardpg:password@172.17.0.1:3306/tetardpg',
  entities: [
    User,
    Character,
    LevelThreshold,
    CombatLog,
    Item,
    CharacterItem,
    Material,
    CharacterMaterial,
    Transaction,
    TetardCoin,
    ProcessedEvent,
    Recipe,
    CraftJob,
    Monster,
    Achievement,
    PlayerAchievement,
    CommunityGoal,
    CommunityContribution,
    ActiveBoost,
    HallOfFame,
  ],
  migrations: [__dirname + '/migrations/*{.ts,.js}'],
  synchronize: false,
});
