
from sqlalchemy.ext.asyncio import AsyncSession

from src.db.models.rf_project_report import RfProjectReport
from src.repository.rf_project_report_repository import RfProjectReportRepository
from src.db.models.app_user import AppUser




class RfProjectReportService:
    def __init__(self, db: AsyncSession):
        self.db = db
        self.pr_repo = RfProjectReportRepository(db)

    async def get(
            self, 
            user: AppUser| None = None, 
            report_id: int | None = None,
            year: int | None = None,
            report_type: str | None = None,
            project_id: int | None = None,
            load_project: bool = False,
    ) -> RfProjectReport | None:
        return await self.pr_repo.get(
            report_id=report_id,
            year=year,
            report_type=report_type,
            project_id=project_id,
            load_project=load_project,
        )
    
    async def get_list(
            self, 
            report_id: int | None = None,
            year: int | None = None,
            report_type: str | None = None,
            project_id: int | None = None,
    ) -> list[RfProjectReport]:
        return await self.pr_repo.get_list(
            report_id=report_id,
            year=year,
            report_type=report_type,
            project_id=project_id,
        )
