"""Class to hold the data to validate a list of adjustments.""" class AdjustmentsValidationData: """Hold the data to validate a list of adjustments.""" def __init__(self): """Initialize an instance.""" self.payment_entity_close_balance_status_map: dict[str, str] = {} self.account_ids: set[str] = set() self.account_contract_map: dict[str, set[str]] = {} self.account_payment_entity_map: dict[str, str] = {} self.upcs: set[str] = set() self.account_upc_map: dict[str, set[str]] = {} self.account_contract_upc_map: dict[str, dict[str, set[str]]] = {} self.display_upc_upc_map: dict[str, set[str]] = {} self.contract_product_map: dict[str, set[str]] = {} self.contract_label_map: dict[str, set[str]] = {} self.statement_years: set[str] = set() self.statement_periods: dict[str, str] = {} self.adjustment_types: set[str] = set() def add_account_id(self, account_id: str): """Add an account ID to the list of account IDs.""" self.account_ids.add(account_id) def add_account_contract_mapping(self, account_id: str, contract_id: str): """Add an item to the account contract map.""" if account_id not in self.account_contract_map.keys(): self.account_contract_map[account_id] = set() self.account_contract_map[account_id].add(contract_id) def add_upc(self, upc: str): """Add an UPC to the list of UPCs.""" self.upcs.add(upc) def add_account_upc_mapping(self, account_id: str, upc: str): """Add an item to the account upc map.""" if account_id not in self.account_upc_map.keys(): self.account_upc_map[account_id] = set() self.account_upc_map[account_id].add(upc) def add_account_contract_upc_mapping( self, account_id: str, contract_id: str, upc: str ): """Add an item to the account contract upc map.""" if account_id not in self.account_contract_upc_map.keys(): self.account_contract_upc_map[account_id] = {} if contract_id not in self.account_contract_upc_map[account_id].keys(): self.account_contract_upc_map[account_id][contract_id] = set() self.account_contract_upc_map[account_id][contract_id].add(upc) def add_statement_year(self, statement_year: str): """Add a statement year to the list of statement years.""" self.statement_years.add(statement_year) def get_contract_ids(self) -> set[str]: """Get the list of contract IDs based on the account contract map.""" return set().union(*self.account_contract_map.values()) def get_contract_account_map(self) -> dict[str, str]: """Get a map of accounts by contract based on the account contract map.""" contract_account_map = {} for account_id, contract_ids in self.account_contract_map.items(): for contract_id in contract_ids: contract_account_map[contract_id] = account_id return contract_account_map