import sqlalchemy.engine.base

from .exception import incomplete_request_exception

class app_route:
    def _success(self, **kwargs) -> dict:
        return self.__response("success", **kwargs)

    def _fail(self, cause: str, **kwargs) -> dict:
        kwargs["cause"] = cause

        return self.__response("fail", **kwargs)

    def _require(self, sended: dict, *args) -> None:
        for count in args:
            if not count in args:
                raise incomplete_request_exception(count)

    def __response(self, result: str, **kwargs) -> dict:
        kwargs["result"] = result
        
        return kwargs

class app_route_database(app_route):
    def __init__(self, connection: sqlalchemy.engine.base.Engine) -> None:
        self.__connection = connection

    @property
    def _connection(self) -> sqlalchemy.engine.base.Engine:
        return self.__connection

   
