import os
import logging

logging.basicConfig(level=logging.INFO)


def create_metrics_html(filepath: str) -> bool:
    """
    Creates a basic HTML file for displaying system metrics.

    Args:
        filepath: The path to the HTML file.

    Returns:
        True if the file was created successfully, False otherwise.
    """
    try:
        html_content = """
<!DOCTYPE html>
<html>
<head>
    <title>Genesis System Metrics</title>
</head>
<body>
    <h1>Genesis System Metrics Dashboard</h1>
    <p>This dashboard will display various system metrics in the future.</p>
</body>
</html>
"""

        # Ensure the directory exists
        os.makedirs(os.path.dirname(filepath), exist_ok=True)

        with open(filepath, "w") as f:
            f.write(html_content)

        logging.info(f"Successfully created metrics file at {filepath}")
        return True
    except Exception as e:
        logging.error(f"Error creating metrics file: {e}")
        return False


if __name__ == "__main__":
    filepath = "/mnt/e/genesis-system/core/web/metrics.html"
    success = create_metrics_html(filepath)

    if success:
        print(f"Metrics file created at: {filepath}")
    else:
        print("Failed to create metrics file.")