"""
Health Check API Blueprint

This module provides a simple health check endpoint for monitoring
and testing API connectivity.
"""

from flask import Blueprint
from app.utils.response import success_response
from app.utils.logging import get_logger
from app.config import get_config


# Initialize logger
logger = get_logger(__file__)

# Create blueprint
health_bp = Blueprint('health', __name__, url_prefix='/api/v1')


@health_bp.route('/health', methods=['GET'])
def health_check():
    """
    Health check endpoint.

    Returns basic service status and version information.
    Useful for monitoring, load balancers, and testing API connectivity.

    Returns:
        JSON response with status "ok" and version info

    Example:
        GET /api/v1/health

        Response:
        {
            "app": "Code of Conquest",
            "version": "0.1.0",
            "status": 200,
            "timestamp": "2025-11-16T...",
            "result": {
                "status": "ok",
                "service": "Code of Conquest API",
                "version": "0.1.0"
            },
            "error": null,
            "meta": {}
        }
    """
    config = get_config()

    logger.debug("Health check requested")

    return success_response(
        result={
            "status": "ok",
            "service": "Code of Conquest API",
            "version": config.app.version
        }
    )
