from typing import Dict

class Transaction:
    def __init__(self, use_case:str, table:str, properties:Dict):
        self.use_case = use_case
        self.properties = properties
        self.table = table
    
    def to_serializable_dict(self):
        return {
            "use_case": self.use_case,
            "table": self.table,
            "id": self.properties["UniqueID"],
            "properties": self.properties
        }
    
    def id(self):
        return self.properties["UniqueID"]
    
    @staticmethod
    def from_serializable_dict(data: Dict):
        return Transaction(data["use_case"], data["table"], data["properties"])