"""Type utilities.""" from typing import NamedTuple ACCOUNT_TYPE_VENDOR = "vendor" ACCOUNT_TYPE_SUBACCOUNT = "subaccount" class Account(NamedTuple): """Vendor account.""" type: str id: str def __str__(self) -> str: """Convert the account to a string. Returns: str: String representation of the account. """ account_type = "L" if self.type == "subaccount": account_type = "S" return f"{self.id}{account_type}" class Sort(NamedTuple): """Sort order.""" key: str direction: str def __str__(self) -> str: """Convert the sort to a string. Returns: str: String representation of the sort. """ return f"{self.key} {self.direction}" class Resource(NamedTuple): """An abstract resource from neo4j.""" type: str id: str class AuthorizedResources(list): """List of authorized resources.""" profile_type: str = "" full_catalog_access: bool = False class User(NamedTuple): """User account.""" type: str id: str def __str__(self) -> str: """Convert the user to a string. Returns: str: String representation of the user. """ return f"{self.type}:{self.id}"