from datetime import date
from typing import List, Optional

from api.ecoindex.models.responses import ApiEcoindex
from api.models.enums import Version
from sqlalchemy.ext.asyncio.session import AsyncSession
from sqlmodel import select

from db.helper import date_filter


async def get_host_list_db(
    session: AsyncSession,
    version: Optional[Version] = Version.v1,
    q: Optional[str] = None,
    date_from: Optional[date] = None,
    date_to: Optional[date] = None,
    page: Optional[int] = 1,
    size: Optional[int] = 50,
) -> List[str]:
    statement = (
        