from __future__ import annotations

from scraper2_hj3415.app.dart.adapters.out.dto.dart_list_item_dto import (
    DartListItemDto,
)
from scraper2_hj3415.app.dart.domain.constants import DART_DOCUMENT_URL_PREFIX
from scraper2_hj3415.app.dart.domain.entities.dart_report import DartReport


class DartReportMapper:
    """
    외부 DTO -> 코어 도메인 변환 책임.
    """

    @staticmethod
    def from_item_dto(dto: DartListItemDto) -> DartReport:
        return DartReport(
            corp_cls=dto.corp_cls,
            corp_code=dto.corp_code,
            corp_name=dto.corp_name,
            stock_code=dto.stock_code,
            report_nm=dto.report_nm,
            rcept_no=dto.rcept_no,
            link=f"{DART_DOCUMENT_URL_PREFIX}{dto.rcept_no}",
            flr_nm=dto.flr_nm,
            rcept_dt=dto.rcept_dt,
        )
