package race_types

// RaceType represents a race type structure for NPCs and creatures
// Converted from C++ RaceTypeStructure
type RaceType struct {
	RaceTypeID  int16  // The actual race type ID
	Category    string // Main category (e.g., "DRAGONKIND", "NATURAL")
	Subcategory string // Subcategory (e.g., "DRAGON", "ANIMAL")
	ModelName   string // 3D model name for rendering
}

// Copy creates a deep copy of the RaceType
func (rt *RaceType) Copy() *RaceType {
	if rt == nil {
		return nil
	}
	return &RaceType{
		RaceTypeID:  rt.RaceTypeID,
		Category:    rt.Category,
		Subcategory: rt.Subcategory,
		ModelName:   rt.ModelName,
	}
}

// IsValid checks if the race type has valid data
func (rt *RaceType) IsValid() bool {
	return rt != nil && rt.RaceTypeID > 0 && rt.Category != ""
}

// Statistics tracks race type usage and queries
type Statistics struct {
	TotalRaceTypes     int64            // Total number of race types loaded
	QueriesByModel     int64            // Number of queries by model ID
	QueriesByCategory  int64            // Number of queries by category
	CategoryCounts     map[string]int64 // Count of race types per category
	SubcategoryCounts  map[string]int64 // Count of race types per subcategory
}

// NewStatistics creates a new statistics tracker
func NewStatistics() *Statistics {
	return &Statistics{
		CategoryCounts:    make(map[string]int64),
		SubcategoryCounts: make(map[string]int64),
	}
}