import pytest
import json
from unittest.mock import MagicMock
from aura_core.types import LLMResponse

MOCK_ANALYSIS_JSON = {
    "domain": "test.com",
    "keywords": ["test", "example"],
    "interpretations": ["A testing domain"],
    "domain_summary": "A domain for testing purposes",
    "niches": [
        {
            "name": "Software Testing",
            "description": "Tools and resources for software testing",
            "score": 8,
            "monetization_model": "affiliate",
            "target_audience": "Developers, QA Engineers",
            "time_to_revenue": "medium",
            "valuation_band": "5000-20000",
            "affiliate_programs": ["TestRail", "BrowserStack", "Sauce Labs"],
            "requires_inventory": False,
            "synopsis": "A niche focused on software testing tools and methodologies."
        }
    ]
}

MOCK_BRAND_JSON = {
    "options": [
        {"name": "TestBrand", "tagline": "Quality First"},
        {"name": "TestPro", "tagline": "Professional Testing"},
        {"name": "QualityHub", "tagline": "Your Testing Partner"}
    ],
    "recommended": 0,
    "color_primary": "#4F46E5",
    "color_secondary": "#7C3AED",
    "color_accent": "#06B6D4",
    "industry_context": "Software testing and quality assurance"
}

@pytest.fixture
def mock_llm_json():
    def _mock(return_data: dict):
        mock = MagicMock()
        mock.return_value = LLMResponse(
            content=json.dumps(return_data),
            model="mock-model",
            usage={"prompt_tokens": 100, "completion_tokens": 50}
        )
        return mock
    return _mock

@pytest.fixture
def mock_llm_text():
    def _mock(return_text: str):
        mock = MagicMock()
        mock.return_value = LLMResponse(
            content=return_text,
            model="mock-model",
            usage={"prompt_tokens": 100, "completion_tokens": 50}
        )
        return mock
    return _mock

@pytest.fixture
def sample_analysis():
    return MOCK_ANALYSIS_JSON.copy()

@pytest.fixture
def sample_brand():
    return MOCK_BRAND_JSON.copy()

@pytest.fixture
def sample_niche():
    return MOCK_ANALYSIS_JSON["niches"][0].copy()

@pytest.fixture
def sample_domain():
    return "test.com"
