import sys
from datetime import datetime
from pathlib import Path

sys.path.insert(0, str(Path(__file__).resolve().parent.parent))

from app.utils.logging_config import setup_logging
from app.orchestrator.pipeline import run_daily_pipeline


def prompt_target_date():
    while True:
        raw = input("Hangi tarih için video hazırlansın? (GG.AA.YYYY, boş = bugün): ").strip()
        if not raw:
            return None
        try:
            return datetime.strptime(raw, "%d.%m.%Y").date()
        except ValueError:
            print("Geçersiz format. Örnek: 24.07.2026")


def main():
    setup_logging()
    target_date = prompt_target_date()
    run_daily_pipeline(target_date)


if __name__ == "__main__":
    main()
