"""Sdílený hook po importu cen / forecastu – obnova cache predikce záporných cen."""

from __future__ import annotations

import logging

import asyncpg

logger = logging.getLogger(__name__)


async def refresh_negative_price_predictions(conn: asyncpg.Connection, site_id: int) -> None:
    try:
        await conn.fetch(
            "SELECT * FROM ems.fn_predict_negative_price_windows($1, 7)", site_id
        )
    except Exception:
        logger.warning(
            "fn_predict_negative_price_windows failed for site %s",
            site_id,
            exc_info=True,
        )
