import datetime
from typing import List, Optional

from lxml.cssselect import CSSSelector

from fundus.parser import ArticleBody, BaseParser, ParserProxy, attribute
from fundus.parser.utility import (
    extract_article_body_with_selector,
    generic_author_parsing,
    generic_date_parsing,
    generic_topic_parsing,
)


class FinancialTimesParser(ParserProxy):
    class V1(BaseParser):
        pass
        # _summary_selector = CSSSelector("div[data-gu-name='standfirst'] p")
        # _paragraph_selector = CSSSelector(".article-body-viewer-selector > p")
        #
        # @attribute
        # def body(self) -> ArticleBody:
        #     return extract_article_body_with_selector(
        #         self.precomputed.doc,
        #         summary_selector=self._summary_selector,
        #         paragraph_selector=self._paragraph_selector,
        #     )
        #
        # @attribute
        # def publishing_date(self) -> Optional[datetime.datetime]:
        #     return generic_date_parsing(self.precomputed.ld.bf_search("datePublished"))
        #
        # @attribute
        # def authors(self) -> List[str]:
        #     return generic_author_parsing(self.precomputed.ld.bf_search("author"))
        #
        # @attribute
        # def title(self) -> Optional[str]:
        #     return self.precomputed.ld.bf_search("headline")
        #
        # @attribute
        # def topics(self) -> List[str]:
        #     return generic_topic_parsing(self.precomputed.meta.get("article:tag"))
