from typing import Optional
from typing import List
import string
import random


def randomString(size:int = 10, pool:Optional[List[int]] = None, extra:str = "", remove:str=",`'") -> str:
	"""
		returns a random generated string by size
		based on the allowed char pool,
		extra chars can be passed by 'extra', removed via 'remove'
		(remove first, then add extra)

		Pools:
		------
		* 1 - digits
		* 2 - uppercase chars
		* 3 - lowercase chars
		* 4 - punctuation

		Default Pool is = [1,2,3]
	"""
	if not pool: pool = [1,2,3]
	string_pool:str = ""
	if 1 in pool: string_pool += string.digits
	if 2 in pool: string_pool += string.ascii_uppercase
	if 3 in pool: string_pool += string.ascii_lowercase
	if 4 in pool: string_pool += string.punctuation

	# remove unwanted
	for char in remove:
		string_pool = string_pool.replace(char, "")

	# add extra
	string_pool += extra

	key = ''.join(random.choice(string_pool) for _ in range(size))
	return key