#!/usr/bin/env python3
"""TDD tests for generate_hybrid.py"""

import sys
from pathlib import Path

# generate_hybrid 모듈을 import (아직 없으면 테스트 FAIL)
import generate_hybrid as gh
import pytest

# ─────────────────────────────────────────────────────────────────────────────
# SCENARIOS 상수 테스트
# ─────────────────────────────────────────────────────────────────────────────


class TestScenarios:
    def test_scenarios_has_three_keys(self):
        assert len(gh.SCENARIOS) == 3

    def test_scenarios_has_key_a(self):
        assert "A" in gh.SCENARIOS

    def test_scenarios_has_key_b(self):
        assert "B" in gh.SCENARIOS

    def test_scenarios_has_key_c(self):
        assert "C" in gh.SCENARIOS

    def test_scenario_a_has_scenario_key(self):
        assert "scenario" in gh.SCENARIOS["A"]
        assert gh.SCENARIOS["A"]["scenario"] == "A"

    def test_scenario_b_has_scenario_key(self):
        assert "scenario" in gh.SCENARIOS["B"]
        assert gh.SCENARIOS["B"]["scenario"] == "B"

    def test_scenario_c_has_scenario_key(self):
        assert "scenario" in gh.SCENARIOS["C"]
        assert gh.SCENARIOS["C"]["scenario"] == "C"

    def test_scenario_a_headline_not_empty(self):
        assert gh.SCENARIOS["A"].get("headline", "").strip() != ""

    def test_scenario_b_headline_not_empty(self):
        assert gh.SCENARIOS["B"].get("headline", "").strip() != ""

    def test_scenario_c_headline_not_empty(self):
        assert gh.SCENARIOS["C"].get("headline", "").strip() != ""

    def test_scenario_a_subtext_not_empty(self):
        assert gh.SCENARIOS["A"].get("subText", "").strip() != ""

    def test_scenario_b_subtext_not_empty(self):
        assert gh.SCENARIOS["B"].get("subText", "").strip() != ""

    def test_scenario_c_subtext_not_empty(self):
        assert gh.SCENARIOS["C"].get("subText", "").strip() != ""


# ─────────────────────────────────────────────────────────────────────────────
# 경로 상수 테스트
# ─────────────────────────────────────────────────────────────────────────────


class TestPaths:
    def test_output_dir_is_v4_hybrid_folder(self):
        assert gh.OUTPUT_DIR.name == "v4-hybrid"

    def test_template_path_is_overlay_template(self):
        assert gh.TEMPLATE_PATH.name == "overlay_template.html"

    def test_template_path_is_absolute(self):
        assert gh.TEMPLATE_PATH.is_absolute()

    def test_output_dir_is_absolute(self):
        assert gh.OUTPUT_DIR.is_absolute()


# ─────────────────────────────────────────────────────────────────────────────
# get_bg_path() 함수 테스트
# ─────────────────────────────────────────────────────────────────────────────


class TestGetBgPath:
    def test_get_bg_path_a_returns_bg_a_jpg(self):
        result = gh.get_bg_path("A")
        assert result.name == "bg_A.jpg"

    def test_get_bg_path_b_returns_bg_b_jpg(self):
        result = gh.get_bg_path("B")
        assert result.name == "bg_B.jpg"

    def test_get_bg_path_c_returns_bg_c_jpg(self):
        result = gh.get_bg_path("C")
        assert result.name == "bg_C.jpg"

    def test_get_bg_path_a_is_absolute(self):
        result = gh.get_bg_path("A")
        assert result.is_absolute()

    def test_get_bg_path_a_is_in_v4_hybrid(self):
        result = gh.get_bg_path("A")
        assert result.parent.name == "v4-hybrid"


# ─────────────────────────────────────────────────────────────────────────────
# get_hybrid_output_path() 함수 테스트
# ─────────────────────────────────────────────────────────────────────────────


class TestGetHybridOutputPath:
    def test_get_hybrid_output_path_a_returns_hybrid_a_png(self):
        result = gh.get_hybrid_output_path("A")
        assert result.name == "hybrid_A.png"

    def test_get_hybrid_output_path_b_returns_hybrid_b_png(self):
        result = gh.get_hybrid_output_path("B")
        assert result.name == "hybrid_B.png"

    def test_get_hybrid_output_path_c_returns_hybrid_c_png(self):
        result = gh.get_hybrid_output_path("C")
        assert result.name == "hybrid_C.png"

    def test_get_hybrid_output_path_a_is_absolute(self):
        result = gh.get_hybrid_output_path("A")
        assert result.is_absolute()

    def test_get_hybrid_output_path_a_is_in_v4_hybrid(self):
        result = gh.get_hybrid_output_path("A")
        assert result.parent.name == "v4-hybrid"
