# !!! DO NOT MODIFY !!!
# Automatically generated Base Manager class
# Generated by "szndaogen" tool

import typing
from szndaogen.data_access.manager_base import {{ "TableManagerBase" if tableType=="BASE TABLE" else "ViewManagerBase" }}
from ...models.{{ tableName }}_model import {{modelName}}Model


class {{modelName}}ManagerBase({{ "TableManagerBase" if tableType=="BASE TABLE" else "ViewManagerBase" }}):
    MODEL_CLASS = {{modelName}}Model

    @classmethod
    def create_model_instance(cls, init_data: typing.Dict = None) -> {{ modelName}}Model:
        if init_data is None:
            init_data = {}

        return super().create_model_instance(init_data)

    def select_one(self
        {%-  if primaryKeys -%}, {% for item in primaryKeys %}{{ item }}: {{ dataTypes[item] }}{{ ", " if not loop.last }}{% endfor %}, condition: str = "1", condition_params: typing.Tuple = (), projection: typing.Tuple = (), order_by: typing.Tuple = ()
        {%-  else %}, condition: str = "1", condition_params: typing.Tuple = (), projection: typing.Tuple = (), order_by: typing.Tuple = ()
        {%- endif -%}
        ) -> {{ modelName}}Model:
        return super().select_one(
        {%-  if primaryKeys -%}{% for item in primaryKeys %}{{ item }}{{ ", " if not loop.last }}{% endfor %}, condition=condition, condition_params=condition_params, projection=projection, order_by=order_by
        {%-  else %}condition=condition, condition_params=condition_params, projection=projection, order_by=order_by
        {%- endif -%}
        )

    def select_all(self, condition: str = "1", condition_params: typing.Tuple = (), projection: typing.Tuple = (), order_by: typing.Tuple = (), limit: int = 0, offset: int = 0) -> typing.List[{{modelName}}Model]:
        return super().select_all(condition=condition, condition_params=condition_params, projection=projection, order_by=order_by, limit=limit, offset=offset)

