
from sqlalchemy.ext.asyncio import AsyncSession

from src.db.models.app_user import AppUser
from src.db.models.budget_line import BudgetLine
from src.repository.budget_line_repository import BudgetLineRepository




class BudgetLineService:
    def __init__(self, db: AsyncSession):
        self.db = db
        self.bl_repo = BudgetLineRepository(db)

    async def get(
            self, 
            user: AppUser, 
            budget_line_id: int,
    ) -> BudgetLine | None:
        return await self.bl_repo.get(budget_line_id=budget_line_id)

    async def get_list(
            self, 
            user: AppUser, 
            budget_line_ids: list[int],
    ) -> list[BudgetLine]:
        return await self.bl_repo.get_list(budget_line_ids=budget_line_ids)

    async def get_ids(
            self,
            budget_form_id: int,
    ) -> list[int]:
        return await self.bl_repo.get_ids(budget_form_id=budget_form_id)
        
