from argparse import _SubParsersAction
from functools import partial
from typing import List
from lxml.objectify import IntElement, StringElement, BoolElement
from .db_object import DbObject
from .representation_row_base import RepresentationRowBase
[docs]
class GtCaseDecisionReasonRow(RepresentationRowBase):
CaseDecisionReasonID: IntElement = "CaseDecisionReasonID"
Reason: StringElement = "Reason"
Enabled: BoolElement = "Enabled"
ProcedureDoc: StringElement = "ProcedureDoc"
IsAuthorize: BoolElement = "IsAuthorize"
IsCancel: BoolElement = "IsCancel"
DateEffective: StringElement = "DateEffective"
[docs]
class GtCaseDecisionReason(DbObject):
# GET_BY_NAME_KEY = "column in the db response"
NAME = "GtCaseDecisionReason"
REPRESENTATION_ROW_CLASS = GtCaseDecisionReasonRow
[docs]
def add_arguments(self, parser: _SubParsersAction):
subparser = parser.add_parser("get_gt_case_decision_reason")
subparser.set_defaults(parser="get")
subparser.set_defaults(func=partial(self.get, serialize_for_cli=True))
[docs]
async def get(self, serialize_for_cli=False) -> List[GtCaseDecisionReasonRow]:
response = await self.call_hq("sdk_GetGtCaseDecisionReason")
if serialize_for_cli:
columns = ["CaseDecisionReasonID", "Reason", "Enabled"]
response = self.serialize_for_cli(response, columns)
return response