// CDataBase - [2020-04-13 11:57:46]
#ifndef _CDATABASE_H_
#define _CDATABASE_H_

#include "TPlayerInfoLight.h"

/*
0011AB70 CDataBase::CDataBase()
0011AB78 CDataBase::~CDataBase()
0011AB48 CDataBase::GetInstance()
0011AB84 CDataBase::FreeTeams()
0011AB98 CDataBase::CalculateTiers()
0011AC70 CDataBase::GetSortedRatingListForLeague(int *,int,int,int,int &)
0011AEA4 CDataBase::GetTeamInfo(int)
0011AF04 CDataBase::LoadTeams()
0011AFE0 CDataBase::Init()
0011B00C CDataBase::Shutdown()
0011B030 CDataBase::GetTeam(int)
0011B048 CDataBase::GetTeamIndex(int)
0011B078 CDataBase::GetTeamCount()
0011B088 CDataBase::GetTeamCount(ELeague)
0011B0BC CDataBase::GetTeamCount(int)
0011B0F8 CDataBase::IsLeagueInternational(ELeague,int)
0011B116 CDataBase::IsTeamInternational(int)
0011B140 CDataBase::GetLeagueForTeamID(int)
0011B150 CDataBase::GetSortedAlphabeticalListForLeague(int,int &,int *,int,int,int,bool)
0011B37C CDataBase::GetTeamName(int,ETeamNameType)
0011B408 CDataBase::GetSortedAlphabeticalListForGivenTeams(int *,int)
0011B4B8 CDataBase::GetSortedRatingListForTier(int,int,int,int &,bool)
0011B6E8 CDataBase::GetCompetitionName(wchar_t *,int,ELeague,int)
0011B7EC CDataBase::GetCountryName(wchar_t *,int,ELeague)
0011B838 CDataBase::GetDefaultTeam(int)
0011B848 CDataBase::GetTeamIDFromLeagueWithTier(int,int,int *,int)
0011B92C CDataBase::GetXBestTeamInLeague(ELeague,int,int,int)
0011B952 CDataBase::GetXBestTeamInTier(int,int,int,int)
*/

struct TTeamInfo_Struct_28 {
  char field_0[0x28];
};

//-------------------------------------------------------------------------------------------------
enum ELeague {
  ELeague_neg1 = -1,
  ELeague_0 = 0,
  ELeague_1,
  ELeague_2,
  ELeague_3,
  ELeague_4,
  ELeague_5,
  ELeague_6,
  ELeague_7,
  ELeague_8,
  ELeague_9,
  ELeague_10,
  ELeague_11,
  ELeague_12,
  ELeague_13,
  ELeague_14,
};
//-------------------------------------------------------------------------------------------------
enum ETeamNameType {
  ETeamNameType_0,
  ETeamNameType_1,
  ETeamNameType_2,
  ETeamNameType_3,
  ETeamNameType_4,
  ETeamNameType_5,
};
//-------------------------------------------------------------------------------------------------
// TTeamInfo 结构体长度 0x11E0
struct TTeamInfo {
  int index_0;
  ELeague dLeagueId_4;
  TTeamInfo_Struct_28 field_8[2];
  TTeamInfo_Struct_28 field_58[2];
  int field_A8[2];
  int field_B0[2];
  int field_B8[2];
  int field_C0[2];
  int field_C8;
  uchar field_CC[0xFDC];
  TPlayerInfoLight ptplayerInfoLight_10A8[0x10];
  TPlayerInfoLight tplayerInfoLight_11C8;
  uchar field_11DA;
  uchar field_11DB;
  int field_11DC;
};
//-------------------------------------------------------------------------------------------------
// 0x11DC
struct TTeamInfoFileNode {
  uchar tmp[0x11DC];
};
//-------------------------------------------------------------------------------------------------
class CDataBase {
public:
  // 0011AB70
  CDataBase();

  // 0011AB78
  ~CDataBase();

  // 0011AB48
  static CDataBase *GetInstance();

  // 0011AB84
  void FreeTeams();

  // 0011AB98
  static void CalculateTiers();

  // 0011AC70
  static ushort *GetSortedRatingListForLeague(int *a1, int a2, int a3, int a4, int &a5);

  // 0011AEA4
  static TTeamInfo *GetTeamInfo(int);

  // 0011AF04
  void LoadTeams();

  // 0011AFE0
  static void Init();

  // 0011B00C
  static void Shutdown();

  // 0011B030
  static TTeamInfo *GetTeam(int index);

  // 0011B048
  static int GetTeamIndex(int index);

  // 0011B078
  static int GetTeamCount();

  // 0011B088
  static int GetTeamCount(ELeague e);

  // 0011B0BC
  static int GetTeamCount(int d);

  // 0011B0F8
  static bool IsLeagueInternational(ELeague e, int a);

  // 0011B116
  static bool IsTeamInternational(int a);

  // 0011B140
  static ELeague GetLeagueForTeamID(int a);

  // 0011B150
  static wchar_t *GetSortedAlphabeticalListForLeague(int, int &, int *, int, int, int, bool);

  // 0011B37C
  static wchar_t *GetTeamName(int a, ETeamNameType e);

  // 0011B408
  static ushort *GetSortedAlphabeticalListForGivenTeams(int *, int);

  // 0011B4B8
  static ushort *GetSortedRatingListForTier(int a1, int a2, int a3, int &list, bool a5);

  // 0011B6E8
  static void GetCompetitionName(wchar_t *pbuf, int len, ELeague e, int ar3);

  // 0011B7EC
  static void GetCountryName(wchar_t *, int, ELeague);

  // 0011B838
  static int GetDefaultTeam(int);

  // 0011B848
  static int GetTeamIDFromLeagueWithTier(ELeague e, int a2, int *list, int count);

  // 0011B92C
  static int GetXBestTeamInLeague(ELeague, int, int, int);

  // 0011B952
  static int GetXBestTeamInTier(int, int, int, int);

  bool bInit_0;
  // int field_1;
  // int field_2;
  // int field_3;
  TTeamInfo *pTteamInfo_4;
  int dTeamCount_8;
  wchar_t pbuf_C[32];

  static CDataBase *ms_pInstance;
};
//-------------------------------------------------------------------------------------------------
#endif  //_CDATABASE_H_