"""Vendor logic module.""" import uuid from permissions.models import identity as identity_model, neo4j_vendor from permissions.types import Vendor def get_directly_accessible_vendors_by_profile( identity_id: uuid.UUID, profile_id: int, profile_type: str, ) -> list[Vendor]: """ Get accessible vendors for the identity and profile. Args: identity_id (uuid.UUID): The user's identity id. profile_id (str): The profile id. profile_type (str): The profile type. Returns: list[Vendor]: A list of Vendor objects. """ # check if the profile exists. profile = identity_model.get_profile_by_identity_id_and_profile_id_and_type( identity_id=identity_id, profile_id=profile_id, profile_type=profile_type ) if not profile: return [] return neo4j_vendor.get_directly_accessible_vendors_by_profile( identity_id=identity_id, profile_id=profile_id, profile_type=profile_type, )