from typing import Annotated from fastapi import Depends from api.application.abstractions.transaction import TransactionContextManager from api.application.protocols.password_hasher import PasswordHasher from api.application.usecase.auth.create_user import CreateUser from api.application.usecase.company.create_company import CreateCompany from api.application.usecase.company.get_users_company import \ GetCompaniesByOwnerEmail from api.domain.company.repository import CompanyRepository from api.domain.user.repository import UserRepository from api.infrastructure.dependencies.stub import Stub def provide_create_user( user_repository: Annotated[UserRepository, Depends(Stub(UserRepository))], transaction: Annotated[ TransactionContextManager, Depends(Stub(TransactionContextManager)) ], password_hasher: Annotated[PasswordHasher, Depends(Stub(PasswordHasher))], ) -> CreateUser: return CreateUser( transaction=transaction, user_repository=user_repository, password_hasher=password_hasher, ) def provide_get_companies_by_email( company_repository: Annotated[CompanyRepository, Depends(Stub(CompanyRepository))], transaction: Annotated[ TransactionContextManager, Depends(Stub(TransactionContextManager)) ], ) -> GetCompaniesByOwnerEmail: return GetCompaniesByOwnerEmail( transaction=transaction, company_repository=company_repository ) def provide_create_company( company_repository: Annotated[CompanyRepository, Depends(Stub(CompanyRepository))], transaction: Annotated[ TransactionContextManager, Depends(Stub(TransactionContextManager)) ], ) -> CreateCompany: return CreateCompany(transaction=transaction, company_repository=company_repository)