"""
CSSL Data Types - Advanced container types for CSO Service Script Language

Types:
- datastruct<T>: Universal container (lazy declarator) - can hold any type
- shuffled<T>: Unorganized fast storage for multiple returns
- iterator<T>: Advanced iterator with programmable tasks
- combo<T>: Filter/search spaces for open parameter matching
- dataspace<T>: SQL/data storage container
- openquote<T>: SQL openquote container
"""

from typing import Any, Dict, List, Optional, Callable, Union, TypeVar, Generic
from dataclasses import dataclass, field
import copy


T = TypeVar('T')


class DataStruct(list):
    """Universal container - lazy declarator that can hold any type.

    Like a vector but more flexible. Can hold strings, ints, floats,
    objects, etc. at the cost of performance.

    Usage:
        datastruct<dynamic> myData;
        myData +<== someValue;
        myData.content()  # Returns all elements
    """

    def __init__(self, element_type: str = 'dynamic'):
        super().__init__()
        self._element_type = element_type
        self._metadata: Dict[str, Any] = {}

    def content(self) -> list:
        """Return all elements as a list"""
        return list(self)

    def add(self, item: Any) -> 'DataStruct':
        """Add an item to the datastruct"""
        self.append(item)
        return self

    def remove_where(self, predicate: Callable[[Any], bool]) -> 'DataStruct':
        """Remove items matching predicate"""
        to_remove = [item for item in self if predicate(item)]
        for item in to_remove:
            self.remove(item)
        return self

    def find_where(self, predicate: Callable[[Any], bool]) -> Optional[Any]:
        """Find first item matching predicate"""
        for item in self:
            if predicate(item):
                return item
        return None

    def convert(self, target_type: type) -> Any:
        """Convert first element to target type"""
        if len(self) > 0:
            return target_type(self[0])
        return None

    def begin(self) -> int:
        """Return iterator to beginning (C++ style)"""
        return 0

    def end(self) -> int:
        """Return iterator to end (C++ style)"""
        return len(self)


class Stack(list):
    """Stack data structure (LIFO).

    Standard stack with push/pop operations.

    Usage:
        stack<string> myStack;
        myStack.push("Item1");
        myStack.push("Item2");
        item = myStack.pop();  # Returns "Item2"
    """

    def __init__(self, element_type: str = 'dynamic'):
        super().__init__()
        self._element_type = element_type

    def push(self, item: Any) -> 'Stack':
        """Push item onto stack"""
        self.append(item)
        return self

    def push_back(self, item: Any) -> 'Stack':
        """Push item onto stack (alias for push)"""
        self.append(item)
        return self

    def peek(self) -> Any:
        """View top item without removing"""
        return self[-1] if self else None

    def is_empty(self) -> bool:
        """Check if stack is empty"""
        return len(self) == 0

    def isEmpty(self) -> bool:
        """Check if stack is empty (camelCase alias)"""
        return len(self) == 0

    def size(self) -> int:
        """Return stack size"""
        return len(self)

    def length(self) -> int:
        """Return stack length (alias for size)"""
        return len(self)

    def contains(self, item: Any) -> bool:
        """Check if stack contains item"""
        return item in self

    def indexOf(self, item: Any) -> int:
        """Find index of item (-1 if not found)"""
        try:
            return self.index(item)
        except ValueError:
            return -1

    def toArray(self) -> list:
        """Convert stack to array"""
        return list(self)

    def swap(self) -> 'Stack':
        """Swap top two elements"""
        if len(self) >= 2:
            self[-1], self[-2] = self[-2], self[-1]
        return self

    def dup(self) -> 'Stack':
        """Duplicate top element"""
        if self:
            self.append(self[-1])
        return self

    def begin(self) -> int:
        """Return iterator to beginning (C++ style)"""
        return 0

    def end(self) -> int:
        """Return iterator to end (C++ style)"""
        return len(self)


class Vector(list):
    """Dynamic array (vector) data structure.

    Resizable array with efficient random access.

    Usage:
        vector<int> myVector;
        myVector.push(1);
        myVector.push(2);
        myVector.at(0);  # Returns 1
    """

    def __init__(self, element_type: str = 'dynamic'):
        super().__init__()
        self._element_type = element_type

    def push(self, item: Any) -> 'Vector':
        """Add item to end"""
        self.append(item)
        return self

    def push_back(self, item: Any) -> 'Vector':
        """Add item to end (alias for push)"""
        self.append(item)
        return self

    def push_front(self, item: Any) -> 'Vector':
        """Add item to front"""
        self.insert(0, item)
        return self

    def pop_back(self) -> Any:
        """Remove and return last element"""
        return self.pop() if self else None

    def pop_front(self) -> Any:
        """Remove and return first element"""
        return self.pop(0) if self else None

    def at(self, index: int) -> Any:
        """Get item at index"""
        if 0 <= index < len(self):
            return self[index]
        return None

    def set(self, index: int, value: Any) -> 'Vector':
        """Set item at index"""
        if 0 <= index < len(self):
            self[index] = value
        return self

    def size(self) -> int:
        """Return vector size"""
        return len(self)

    def length(self) -> int:
        """Return vector length (alias for size)"""
        return len(self)

    def empty(self) -> bool:
        """Check if vector is empty"""
        return len(self) == 0

    def isEmpty(self) -> bool:
        """Check if vector is empty (camelCase alias)"""
        return len(self) == 0

    def front(self) -> Any:
        """Get first element"""
        return self[0] if self else None

    def back(self) -> Any:
        """Get last element"""
        return self[-1] if self else None

    def contains(self, item: Any) -> bool:
        """Check if vector contains item"""
        return item in self

    def indexOf(self, item: Any) -> int:
        """Find index of item (-1 if not found)"""
        try:
            return self.index(item)
        except ValueError:
            return -1

    def lastIndexOf(self, item: Any) -> int:
        """Find last index of item (-1 if not found)"""
        for i in range(len(self) - 1, -1, -1):
            if self[i] == item:
                return i
        return -1

    def find(self, predicate: Callable[[Any], bool]) -> Any:
        """Find first item matching predicate"""
        for item in self:
            if callable(predicate) and predicate(item):
                return item
            elif item == predicate:
                return item
        return None

    def findIndex(self, predicate: Callable[[Any], bool]) -> int:
        """Find index of first item matching predicate"""
        for i, item in enumerate(self):
            if callable(predicate) and predicate(item):
                return i
            elif item == predicate:
                return i
        return -1

    def slice(self, start: int, end: int = None) -> 'Vector':
        """Return slice of vector"""
        if end is None:
            result = Vector(self._element_type)
            result.extend(self[start:])
        else:
            result = Vector(self._element_type)
            result.extend(self[start:end])
        return result

    def join(self, separator: str = ',') -> str:
        """Join elements into string"""
        return separator.join(str(item) for item in self)

    def map(self, func: Callable[[Any], Any]) -> 'Vector':
        """Apply function to all elements"""
        result = Vector(self._element_type)
        result.extend(func(item) for item in self)
        return result

    def filter(self, predicate: Callable[[Any], bool]) -> 'Vector':
        """Filter elements by predicate"""
        result = Vector(self._element_type)
        result.extend(item for item in self if predicate(item))
        return result

    def forEach(self, func: Callable[[Any], None]) -> 'Vector':
        """Execute function for each element"""
        for item in self:
            func(item)
        return self

    def toArray(self) -> list:
        """Convert to plain list"""
        return list(self)

    def fill(self, value: Any, start: int = 0, end: int = None) -> 'Vector':
        """Fill range with value"""
        if end is None:
            end = len(self)
        for i in range(start, min(end, len(self))):
            self[i] = value
        return self

    def every(self, predicate: Callable[[Any], bool]) -> bool:
        """Check if all elements match predicate"""
        return all(predicate(item) for item in self)

    def some(self, predicate: Callable[[Any], bool]) -> bool:
        """Check if any element matches predicate"""
        return any(predicate(item) for item in self)

    def reduce(self, func: Callable[[Any, Any], Any], initial: Any = None) -> Any:
        """Reduce vector to single value"""
        from functools import reduce as py_reduce
        if initial is None:
            return py_reduce(func, self)
        return py_reduce(func, self, initial)

    def begin(self) -> int:
        """Return iterator to beginning (C++ style)"""
        return 0

    def end(self) -> int:
        """Return iterator to end (C++ style)"""
        return len(self)


class Array(list):
    """Array data structure with CSSL methods.

    Standard array with push/pop/length operations.

    Usage:
        array<string> arr;
        arr.push("Item");
        arr.length();  # Returns 1
    """

    def __init__(self, element_type: str = 'dynamic'):
        super().__init__()
        self._element_type = element_type

    def push(self, item: Any) -> 'Array':
        """Add item to end"""
        self.append(item)
        return self

    def push_back(self, item: Any) -> 'Array':
        """Add item to end (alias for push)"""
        self.append(item)
        return self

    def push_front(self, item: Any) -> 'Array':
        """Add item to front"""
        self.insert(0, item)
        return self

    def pop_back(self) -> Any:
        """Remove and return last element"""
        return self.pop() if self else None

    def pop_front(self) -> Any:
        """Remove and return first element"""
        return self.pop(0) if self else None

    def at(self, index: int) -> Any:
        """Get item at index"""
        if 0 <= index < len(self):
            return self[index]
        return None

    def set(self, index: int, value: Any) -> 'Array':
        """Set item at index"""
        if 0 <= index < len(self):
            self[index] = value
        return self

    def size(self) -> int:
        """Return array size"""
        return len(self)

    def length(self) -> int:
        """Return array length"""
        return len(self)

    def empty(self) -> bool:
        """Check if array is empty"""
        return len(self) == 0

    def isEmpty(self) -> bool:
        """Check if array is empty (camelCase alias)"""
        return len(self) == 0

    def first(self) -> Any:
        """Get first element"""
        return self[0] if self else None

    def last(self) -> Any:
        """Get last element"""
        return self[-1] if self else None

    def contains(self, item: Any) -> bool:
        """Check if array contains item"""
        return item in self

    def indexOf(self, item: Any) -> int:
        """Find index of item (-1 if not found)"""
        try:
            return self.index(item)
        except ValueError:
            return -1

    def lastIndexOf(self, item: Any) -> int:
        """Find last index of item (-1 if not found)"""
        for i in range(len(self) - 1, -1, -1):
            if self[i] == item:
                return i
        return -1

    def find(self, predicate: Callable[[Any], bool]) -> Any:
        """Find first item matching predicate"""
        for item in self:
            if callable(predicate) and predicate(item):
                return item
            elif item == predicate:
                return item
        return None

    def findIndex(self, predicate: Callable[[Any], bool]) -> int:
        """Find index of first item matching predicate"""
        for i, item in enumerate(self):
            if callable(predicate) and predicate(item):
                return i
            elif item == predicate:
                return i
        return -1

    def slice(self, start: int, end: int = None) -> 'Array':
        """Return slice of array"""
        if end is None:
            result = Array(self._element_type)
            result.extend(self[start:])
        else:
            result = Array(self._element_type)
            result.extend(self[start:end])
        return result

    def join(self, separator: str = ',') -> str:
        """Join elements into string"""
        return separator.join(str(item) for item in self)

    def map(self, func: Callable[[Any], Any]) -> 'Array':
        """Apply function to all elements"""
        result = Array(self._element_type)
        result.extend(func(item) for item in self)
        return result

    def filter(self, predicate: Callable[[Any], bool]) -> 'Array':
        """Filter elements by predicate"""
        result = Array(self._element_type)
        result.extend(item for item in self if predicate(item))
        return result

    def forEach(self, func: Callable[[Any], None]) -> 'Array':
        """Execute function for each element"""
        for item in self:
            func(item)
        return self

    def toArray(self) -> list:
        """Convert to plain list"""
        return list(self)

    def fill(self, value: Any, start: int = 0, end: int = None) -> 'Array':
        """Fill range with value"""
        if end is None:
            end = len(self)
        for i in range(start, min(end, len(self))):
            self[i] = value
        return self

    def every(self, predicate: Callable[[Any], bool]) -> bool:
        """Check if all elements match predicate"""
        return all(predicate(item) for item in self)

    def some(self, predicate: Callable[[Any], bool]) -> bool:
        """Check if any element matches predicate"""
        return any(predicate(item) for item in self)

    def reduce(self, func: Callable[[Any, Any], Any], initial: Any = None) -> Any:
        """Reduce array to single value"""
        from functools import reduce as py_reduce
        if initial is None:
            return py_reduce(func, self)
        return py_reduce(func, self, initial)

    def concat(self, *arrays) -> 'Array':
        """Concatenate with other arrays"""
        result = Array(self._element_type)
        result.extend(self)
        for arr in arrays:
            result.extend(arr)
        return result

    def flat(self, depth: int = 1) -> 'Array':
        """Flatten nested arrays"""
        result = Array(self._element_type)
        for item in self:
            if isinstance(item, (list, Array)) and depth > 0:
                if depth == 1:
                    result.extend(item)
                else:
                    nested = Array(self._element_type)
                    nested.extend(item)
                    result.extend(nested.flat(depth - 1))
            else:
                result.append(item)
        return result

    def unique(self) -> 'Array':
        """Return array with unique elements"""
        result = Array(self._element_type)
        seen = set()
        for item in self:
            key = item if isinstance(item, (int, str, float, bool)) else id(item)
            if key not in seen:
                seen.add(key)
                result.append(item)
        return result

    def begin(self) -> int:
        """Return iterator to beginning (C++ style)"""
        return 0

    def end(self) -> int:
        """Return iterator to end (C++ style)"""
        return len(self)


class Shuffled(list):
    """Unorganized fast storage for multiple returns.

    Stores data unorganized for fast and efficient access.
    Supports receiving multiple return values from functions.

    Usage:
        shuffled<string> results;
        results +<== someFunc();  # Catches all returns
        results.read()  # Returns all content as list
    """

    def __init__(self, element_type: str = 'dynamic'):
        super().__init__()
        self._element_type = element_type

    def read(self) -> list:
        """Return all content as a list"""
        return list(self)

    def collect(self, func: Callable, *args) -> 'Shuffled':
        """Collect all returns from a function"""
        result = func(*args)
        if isinstance(result, (list, tuple)):
            self.extend(result)
        else:
            self.append(result)
        return self


class Iterator:
    """Advanced iterator with programmable tasks.

    Provides iterator positions within a data container with
    the ability to attach tasks (functions) to iterators.

    Usage:
        iterator<int, 16> Map;  # Create 16-element iterator space
        Map::iterator::set(0, 5);  # Set iterator 0 to position 5
        Map::iterator::task(0, myFunc);  # Attach task to iterator
    """

    def __init__(self, element_type: str = 'int', size: int = 16):
        self._element_type = element_type
        self._size = size
        self._data: List[Any] = [None] * size
        self._iterators: Dict[int, int] = {0: 0, 1: 1}  # Default: 2 iterators at positions 0 and 1
        self._tasks: Dict[int, Callable] = {}

    def insert(self, index: int, value: Any) -> 'Iterator':
        """Insert value at index"""
        if 0 <= index < self._size:
            self._data[index] = value
        return self

    def fill(self, value: Any) -> 'Iterator':
        """Fill all positions with value"""
        self._data = [value] * self._size
        return self

    def at(self, index: int) -> Any:
        """Get value at index"""
        if 0 <= index < self._size:
            return self._data[index]
        return None

    def is_all(self, check_value: bool) -> bool:
        """Check if all values are 1 (True) or 0 (False)"""
        expected = 1 if check_value else 0
        return all(v == expected for v in self._data if v is not None)

    def end(self) -> int:
        """Return last index"""
        return self._size - 1

    class IteratorControl:
        """Static methods for iterator control"""

        @staticmethod
        def set(iterator_obj: 'Iterator', iterator_id: int, position: int):
            """Set iterator position"""
            iterator_obj._iterators[iterator_id] = position

        @staticmethod
        def move(iterator_obj: 'Iterator', iterator_id: int, steps: int):
            """Move iterator by steps"""
            if iterator_id in iterator_obj._iterators:
                iterator_obj._iterators[iterator_id] += steps

        @staticmethod
        def insert(iterator_obj: 'Iterator', iterator_id: int, value: Any):
            """Insert value at current iterator position"""
            if iterator_id in iterator_obj._iterators:
                pos = iterator_obj._iterators[iterator_id]
                if 0 <= pos < iterator_obj._size:
                    iterator_obj._data[pos] = value

        @staticmethod
        def pop(iterator_obj: 'Iterator', iterator_id: int):
            """Delete value at current iterator position"""
            if iterator_id in iterator_obj._iterators:
                pos = iterator_obj._iterators[iterator_id]
                if 0 <= pos < iterator_obj._size:
                    iterator_obj._data[pos] = None

        @staticmethod
        def task(iterator_obj: 'Iterator', iterator_id: int, func: Callable):
            """Attach a task function to iterator"""
            iterator_obj._tasks[iterator_id] = func

        @staticmethod
        def dtask(iterator_obj: 'Iterator', iterator_id: int):
            """Clear task from iterator"""
            if iterator_id in iterator_obj._tasks:
                del iterator_obj._tasks[iterator_id]

        @staticmethod
        def run_task(iterator_obj: 'Iterator', iterator_id: int):
            """Run the task at current iterator position"""
            if iterator_id in iterator_obj._tasks and iterator_id in iterator_obj._iterators:
                pos = iterator_obj._iterators[iterator_id]
                task = iterator_obj._tasks[iterator_id]
                # Create a position wrapper
                class IteratorPos:
                    def __init__(self, data, idx):
                        self._data = data
                        self._idx = idx
                    def read(self):
                        return self._data[self._idx]
                    def write(self, value):
                        self._data[self._idx] = value

                task(IteratorPos(iterator_obj._data, pos))


class Combo:
    """Filter/search space for open parameter matching.

    Creates a search/filter space that can match parameters
    based on filter databases and similarity.

    Usage:
        combo<open&string> nameSpace;
        nameSpace +<== [combo::filterdb] filterDB;
        special_name = OpenFind(&nameSpace);
    """

    def __init__(self, element_type: str = 'dynamic'):
        self._element_type = element_type
        self._filterdb: List[Any] = []
        self._blocked: List[Any] = []
        self._data: List[Any] = []
        self._like_pattern: Optional[str] = None

    @property
    def filterdb(self) -> List[Any]:
        return self._filterdb

    @filterdb.setter
    def filterdb(self, value: List[Any]):
        self._filterdb = value

    @property
    def blocked(self) -> List[Any]:
        return self._blocked

    @blocked.setter
    def blocked(self, value: List[Any]):
        self._blocked = value

    def like(self, pattern: str) -> 'Combo':
        """Set similarity pattern (94-100% match)"""
        self._like_pattern = pattern
        return self

    def matches(self, value: Any) -> bool:
        """Check if value matches combo criteria"""
        # Check if blocked
        if value in self._blocked:
            return False

        # Check filterdb if present
        if self._filterdb:
            if value not in self._filterdb:
                return False

        # Check like pattern if present
        if self._like_pattern and isinstance(value, str):
            similarity = self._calculate_similarity(value, self._like_pattern)
            if similarity < 0.94:
                return False

        return True

    def _calculate_similarity(self, s1: str, s2: str) -> float:
        """Calculate string similarity (simple Levenshtein-based)"""
        if s1 == s2:
            return 1.0
        if not s1 or not s2:
            return 0.0

        # Simple character-based similarity
        s1_lower = s1.lower()
        s2_lower = s2.lower()

        matching = sum(c1 == c2 for c1, c2 in zip(s1_lower, s2_lower))
        return matching / max(len(s1), len(s2))

    def find_match(self, items: List[Any]) -> Optional[Any]:
        """Find first matching item from list"""
        for item in items:
            if self.matches(item):
                return item
        return None


class DataSpace(dict):
    """SQL/data storage container for structured data.

    Used for SQL table definitions and structured data storage.

    Usage:
        dataspace<sql::table> table = { ... };
        @Sql.Structured(&table);
    """

    def __init__(self, space_type: str = 'dynamic'):
        super().__init__()
        self._space_type = space_type
        self._sections: Dict[str, Any] = {}

    def content(self) -> dict:
        """Return all content"""
        return dict(self)

    def section(self, name: str, *types) -> 'DataSpace':
        """Create a section with specified types"""
        self._sections[name] = {
            'types': types,
            'data': []
        }
        return self


class OpenQuote:
    """SQL openquote container for organized data handling.

    Creates a datastruct together with sql::db.oqt() for easy
    data organization and retrieval.

    Usage:
        openquote<datastruct<dynamic>&@sql::db.oqt(@db)> Queue;
        Queue.save("Section", "data1", "data2", 123);
        Queue.where(Section="value", KEY="match");
    """

    def __init__(self, db_reference: Any = None):
        self._data: List[Dict[str, Any]] = []
        self._db_ref = db_reference

    def save(self, section: str, *values) -> 'OpenQuote':
        """Save data to a section"""
        self._data.append({
            'section': section,
            'values': list(values)
        })
        return self

    def where(self, **kwargs) -> Optional[Any]:
        """Find data matching criteria"""
        for entry in self._data:
            if all(entry.get(k) == v or (k == 'Section' and entry.get('section') == v)
                   for k, v in kwargs.items()):
                return entry
        return None

    def all(self) -> List[Dict[str, Any]]:
        """Return all data"""
        return self._data


class Parameter:
    """Parameter accessor for CSSL exec() arguments.

    Provides access to arguments passed to CSSL.exec() via parameter.get(index).

    Usage in CSSL:
        parameter.get(0)  # Get first argument
        parameter.get(1)  # Get second argument
        parameter.count() # Get total argument count
        parameter.all()   # Get all arguments as list
        parameter.return(value)  # Yield a return value (generator-like)
        parameter.returns()  # Get all yielded return values
    """

    def __init__(self, args: List[Any] = None):
        self._args = args if args is not None else []
        self._returns: List[Any] = []

    def get(self, index: int, default: Any = None) -> Any:
        """Get argument at index, returns default if not found"""
        if 0 <= index < len(self._args):
            return self._args[index]
        return default

    def count(self) -> int:
        """Return total number of arguments"""
        return len(self._args)

    def all(self) -> List[Any]:
        """Return all arguments as a list"""
        return list(self._args)

    def has(self, index: int) -> bool:
        """Check if argument exists at index"""
        return 0 <= index < len(self._args)

    # Using 'return_' to avoid Python keyword conflict
    def return_(self, value: Any) -> None:
        """Yield a return value (generator-like behavior).

        Multiple calls accumulate values that can be retrieved via returns().
        The CSSL runtime will collect these as the exec() return value.
        """
        self._returns.append(value)

    def returns(self) -> List[Any]:
        """Get all yielded return values"""
        return list(self._returns)

    def clear_returns(self) -> None:
        """Clear all yielded return values"""
        self._returns.clear()

    def has_returns(self) -> bool:
        """Check if any values have been returned"""
        return len(self._returns) > 0

    def __iter__(self):
        return iter(self._args)

    def __len__(self):
        return len(self._args)

    def __getitem__(self, index: int) -> Any:
        return self.get(index)


def OpenFind(combo_or_type: Union[Combo, type], index: int = 0) -> Optional[Any]:
    """Find open parameter by type or combo space.

    Usage:
        string name = OpenFind<string>(0);  # Find string at index 0
        string special = OpenFind(&@comboSpace);  # Find by combo
    """
    if isinstance(combo_or_type, Combo):
        # Find by combo space
        return combo_or_type.find_match([])  # Would need open params context
    elif isinstance(combo_or_type, type):
        # Find by type at index - needs open params context
        pass
    return None


# Type factory functions for CSSL
def create_datastruct(element_type: str = 'dynamic') -> DataStruct:
    return DataStruct(element_type)

def create_shuffled(element_type: str = 'dynamic') -> Shuffled:
    return Shuffled(element_type)

def create_iterator(element_type: str = 'int', size: int = 16) -> Iterator:
    return Iterator(element_type, size)

def create_combo(element_type: str = 'dynamic') -> Combo:
    return Combo(element_type)

def create_dataspace(space_type: str = 'dynamic') -> DataSpace:
    return DataSpace(space_type)

def create_openquote(db_ref: Any = None) -> OpenQuote:
    return OpenQuote(db_ref)

def create_stack(element_type: str = 'dynamic') -> Stack:
    return Stack(element_type)

def create_vector(element_type: str = 'dynamic') -> Vector:
    return Vector(element_type)

def create_parameter(args: List[Any] = None) -> Parameter:
    """Create a Parameter object for accessing exec arguments"""
    return Parameter(args)

def create_array(element_type: str = 'dynamic') -> Array:
    """Create an Array object"""
    return Array(element_type)


__all__ = [
    'DataStruct', 'Shuffled', 'Iterator', 'Combo', 'DataSpace', 'OpenQuote',
    'OpenFind', 'Parameter', 'Stack', 'Vector', 'Array',
    'create_datastruct', 'create_shuffled', 'create_iterator',
    'create_combo', 'create_dataspace', 'create_openquote', 'create_parameter',
    'create_stack', 'create_vector', 'create_array'
]
