import logging

from majak.celery import app
from shared.jekyll_import import JekyllArticleImporter

logger = logging.getLogger(__name__)


@app.task
def import_jekyll_articles(
    article_parent_page_id: int,
    collection_id: int,
    url: str,
    dry_run: bool,
    use_git: bool,
):
    from .models import MainArticlePage, MainArticlesPage

    return JekyllArticleImporter(
        article_parent_page_id=article_parent_page_id,
        collection_id=collection_id,
        url=url,
        dry_run=dry_run,
        use_git=use_git,
        parent_page_model=MainArticlesPage,
        page_model=MainArticlePage,
    ).perform_import()