#!/usr/bin/env python3.12
"""
Basic HTML/asset validation helpers.
"""
from __future__ import annotations

import pathlib
from typing import List

from bs4 import BeautifulSoup


def validate_html(file_path: str) -> List[str]:
    errors: List[str] = []
    path = pathlib.Path(file_path)
    if not path.exists():
        errors.append(f"missing file: {file_path}")
        return errors
    try:
        soup = BeautifulSoup(path.read_text(encoding="utf-8"), "html.parser")
        if not soup.find("html"):
            errors.append("no <html> root element")
    except Exception as exc:  # noqa: BLE001
        errors.append(f"parse error: {exc}")
    return errors


def ensure_assets(asset_dir: str) -> List[str]:
    missing: List[str] = []
    path = pathlib.Path(asset_dir)
    if not path.exists():
        missing.append(f"missing asset directory: {asset_dir}")
    return missing
