func (cfg *Config) validate(log log.Logger, id game.ID, wordValidator WordValidator, userDao UserDao) error {
	if len(cfg.TileLetters) == 0 {
		cfg.TileLetters = defaultTileLetters
	}
	switch {
	case log == nil:
		return fmt.Errorf("log required")
	case id <= 0:
		return fmt.Errorf("positive id required")
	case wordValidator == nil:
		return fmt.Errorf("word validator required")
	case userDao == nil:
		return fmt.Errorf("user dao required")
	case cfg.TimeFunc == nil:
		return fmt.Errorf("time func required")
	case cfg.MaxPlayers <= 0:
		return fmt.Errorf("positive max player count required")
	case cfg.NumNewTiles <= 0:
		return fmt.Errorf("positive number of player starting tile count required")
	case cfg.IdlePeriod <= 0:
		return fmt.Errorf("positive idle period required")
	case cfg.ShuffleUnusedTilesFunc == nil:
		return fmt.Errorf("function to shuffle tiles required")
	case cfg.ShufflePlayersFunc == nil:
		return fmt.Errorf("function to shuffle player draw order required")
	case len(cfg.TileLetters) < cfg.NumNewTiles:
		return fmt.Errorf("not enough tiles for a single player to join the game")
	}
	return nil
}
// validate ensures the configuration has no errors.
// the config is modified to use the default tile letters if the tile letters are empty.
validate ensures the configuration has no errors.
the config is modified to use the default tile letters if the tile letters are empty.
// validate ensures the configuration has no errors . // the config is modified to use the default tile letters if the tile letters are empty .
func (cfg *Config) validate(log log.Logger, id game.ID, wordValidator WordValidator, userDao UserDao) error {
	if len(cfg.TileLetters) == 0 {
		cfg.TileLetters = defaultTileLetters
	}
	switch {
	case log == nil:
		return fmt.Errorf("log required")
	case id <= 0:
		return fmt.Errorf("positive id required")
	case wordValidator == nil:
		return fmt.Errorf("word validator required")
	case userDao == nil:
		return fmt.Errorf("user dao required")
	case cfg.TimeFunc == nil:
		return fmt.Errorf("time func required")
	case cfg.MaxPlayers <= 0:
		return fmt.Errorf("positive max player count required")
	case cfg.NumNewTiles <= 0:
		return fmt.Errorf("positive number of player starting tile count required")
	case cfg.IdlePeriod <= 0:
		return fmt.Errorf("positive idle period required")
	case cfg.ShuffleUnusedTilesFunc == nil:
		return fmt.Errorf("function to shuffle tiles required")
	case cfg.ShufflePlayersFunc == nil:
		return fmt.Errorf("function to shuffle player draw order required")
	case len(cfg.TileLetters) < cfg.NumNewTiles:
		return fmt.Errorf("not enough tiles for a single player to join the game")
	}
	return nil
}
func ( cfg * Config ) validate ( log log . Logger , id game . ID , wordValidator WordValidator , userDao UserDao ) error { if len ( cfg . TileLetters ) == 0 { cfg . TileLetters = defaultTileLetters } switch { case log == nil : return fmt . Errorf ( " " ) case id <= 0 : return fmt . Errorf ( " " ) case wordValidator == nil : return fmt . Errorf ( " " ) case userDao == nil : return fmt . Errorf ( " " ) case cfg . TimeFunc == nil : return fmt . Errorf ( " " ) case cfg . MaxPlayers <= 0 : return fmt . Errorf ( " " ) case cfg . NumNewTiles <= 0 : return fmt . Errorf ( " " ) case cfg . IdlePeriod <= 0 : return fmt . Errorf ( " " ) case cfg . ShuffleUnusedTilesFunc == nil : return fmt . Errorf ( " " ) case cfg . ShufflePlayersFunc == nil : return fmt . Errorf ( " " ) case len ( cfg . TileLetters ) < cfg . NumNewTiles : return fmt . Errorf ( " " ) } return nil }
validate ensures the configuration has no errors.
validate ensures the configuration has no errors .