# AUTO-GENERATED FILE - DO NOT EDIT
# This file was automatically generated by the XDK build tool.
# Any manual changes will be overwritten on the next generation.
"""
Auto-generated structural tests for {"class_name": "Trends", "display_name": "trends", "import_name": "trends", "original": ["trends"], "property_name": "trends"} client.

This module contains tests that validate the structure and API surface
of the {"class_name": "Trends", "display_name": "trends", "import_name": "trends", "original": ["trends"], "property_name": "trends"} client. These tests ensure that all expected methods
exist, have correct signatures, and proper type annotations for robust API contracts.

Generated automatically - do not edit manually.
"""

import pytest
import inspect
from typing import get_type_hints
from xdk.trends.client import TrendsClient
from xdk import Client


class TestTrendsStructure:
    """Test the structure of TrendsClient."""


    def setup_class(self):
        """Set up test fixtures."""
        self.client = Client(base_url="https://api.example.com")
        self.trends_client = getattr(self.client, "trends")


    def test_get_by_woeid_exists(self):
        """Test that get_by_woeid method exists with correct signature."""
        # Check method exists
        method = getattr(TrendsClient, "get_by_woeid", None)
        assert method is not None, f"Method get_by_woeid does not exist on TrendsClient"
        # Check method is callable
        assert callable(method), f"get_by_woeid is not callable"
        # Check method signature
        sig = inspect.signature(method)
        params = list(sig.parameters.keys())
        # Should have 'self' as first parameter
        assert len(params) >= 1, f"get_by_woeid should have at least 'self' parameter"
        assert (
            params[0] == "self"
        ), f"First parameter should be 'self', got '{params[0]}'"
        # Check required parameters exist (excluding 'self')
        required_params = [
            "woeid",
        ]
        for required_param in required_params:
            assert (
                required_param in params
            ), f"Required parameter '{required_param}' missing from get_by_woeid"
        # Check optional parameters have defaults (excluding 'self')
        optional_params = [
            "max_trends",
            "trend.fields",
        ]
        for optional_param in optional_params:
            if optional_param in params:
                param_obj = sig.parameters[optional_param]
                assert (
                    param_obj.default is not inspect.Parameter.empty
                ), f"Optional parameter '{optional_param}' should have a default value"


    def test_get_by_woeid_return_annotation(self):
        """Test that get_by_woeid has proper return type annotation."""
        method = getattr(TrendsClient, "get_by_woeid")
        sig = inspect.signature(method)
        # Check return annotation exists
        assert (
            sig.return_annotation is not inspect.Signature.empty
        ), f"Method get_by_woeid should have return type annotation"


    def test_get_personalized_exists(self):
        """Test that get_personalized method exists with correct signature."""
        # Check method exists
        method = getattr(TrendsClient, "get_personalized", None)
        assert (
            method is not None
        ), f"Method get_personalized does not exist on TrendsClient"
        # Check method is callable
        assert callable(method), f"get_personalized is not callable"
        # Check method signature
        sig = inspect.signature(method)
        params = list(sig.parameters.keys())
        # Should have 'self' as first parameter
        assert (
            len(params) >= 1
        ), f"get_personalized should have at least 'self' parameter"
        assert (
            params[0] == "self"
        ), f"First parameter should be 'self', got '{params[0]}'"
        # Check required parameters exist (excluding 'self')
        required_params = []
        for required_param in required_params:
            assert (
                required_param in params
            ), f"Required parameter '{required_param}' missing from get_personalized"
        # Check optional parameters have defaults (excluding 'self')
        optional_params = [
            "personalized_trend.fields",
        ]
        for optional_param in optional_params:
            if optional_param in params:
                param_obj = sig.parameters[optional_param]
                assert (
                    param_obj.default is not inspect.Parameter.empty
                ), f"Optional parameter '{optional_param}' should have a default value"


    def test_get_personalized_return_annotation(self):
        """Test that get_personalized has proper return type annotation."""
        method = getattr(TrendsClient, "get_personalized")
        sig = inspect.signature(method)
        # Check return annotation exists
        assert (
            sig.return_annotation is not inspect.Signature.empty
        ), f"Method get_personalized should have return type annotation"


    def test_get_ai_exists(self):
        """Test that get_ai method exists with correct signature."""
        # Check method exists
        method = getattr(TrendsClient, "get_ai", None)
        assert method is not None, f"Method get_ai does not exist on TrendsClient"
        # Check method is callable
        assert callable(method), f"get_ai is not callable"
        # Check method signature
        sig = inspect.signature(method)
        params = list(sig.parameters.keys())
        # Should have 'self' as first parameter
        assert len(params) >= 1, f"get_ai should have at least 'self' parameter"
        assert (
            params[0] == "self"
        ), f"First parameter should be 'self', got '{params[0]}'"
        # Check required parameters exist (excluding 'self')
        required_params = [
            "id",
        ]
        for required_param in required_params:
            assert (
                required_param in params
            ), f"Required parameter '{required_param}' missing from get_ai"
        # Check optional parameters have defaults (excluding 'self')
        optional_params = [
            "news.fields",
        ]
        for optional_param in optional_params:
            if optional_param in params:
                param_obj = sig.parameters[optional_param]
                assert (
                    param_obj.default is not inspect.Parameter.empty
                ), f"Optional parameter '{optional_param}' should have a default value"


    def test_get_ai_return_annotation(self):
        """Test that get_ai has proper return type annotation."""
        method = getattr(TrendsClient, "get_ai")
        sig = inspect.signature(method)
        # Check return annotation exists
        assert (
            sig.return_annotation is not inspect.Signature.empty
        ), f"Method get_ai should have return type annotation"


    def test_all_expected_methods_exist(self):
        """Test that all expected methods exist on the client."""
        expected_methods = [
            "get_by_woeid",
            "get_personalized",
            "get_ai",
        ]
        for expected_method in expected_methods:
            assert hasattr(
                TrendsClient, expected_method
            ), f"Expected method '{expected_method}' not found on TrendsClient"
            assert callable(
                getattr(TrendsClient, expected_method)
            ), f"'{expected_method}' exists but is not callable"
