from datetime import datetime
from textwrap import dedent


def html_content(body: str, date: str) -> str:
    """Build the HTML content.

    Parameters
    ----------
    body : str
        Table with the sequencer status report.
    date : str
        Date of the processing YYYY-MM-DD.

    Returns
    -------
    str
        HTML content.
    """
    time_update = datetime.utcnow().strftime("%Y-%m-%d %H:%M:%S")

    return dedent(
        f"""<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
        <html xmlns="http://www.w3.org/1999/xhtml">
         <head>
          <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
          <title>OSA Sequencer status</title><link href="osa.css" rel="stylesheet"
          type="text/css" /><style>table{{width:152ex;}}</style>
         </head>
         <body>
         <h1>OSA processing status</h1>
         <p>Processing data from: {date}. Last updated: {time_update} UTC</p>
         {body}
         </body>
        </html>"""
    )