# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: batch_update_heartbeat_log.sql
import dataclasses
from typing import List
import uuid

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


BATCH_UPDATE_HEARTBEAT_LOG = """-- name: batch_update_heartbeat_log \\:exec
INSERT INTO hyrex_system_logs (id, timestamp, event_name, event_body)
VALUES (
    :p1\\:\\:uuid,
    NOW(),
    'BATCH_HEARTBEAT_UPDATE',
    json_build_object('updated_executor_ids', :p2\\:\\:uuid[])
)
"""


@dataclasses.dataclass()
class BatchUpdateHeartbeatLogParams:
    log_id: uuid.UUID
    executor_ids: List[uuid.UUID]


class Querier:
    def __init__(self, conn: sqlalchemy.engine.Connection):
        self._conn = conn

    def batch_update_heartbeat_log(self, arg: BatchUpdateHeartbeatLogParams) -> None:
        self._conn.execute(sqlalchemy.text(BATCH_UPDATE_HEARTBEAT_LOG), {"p1": arg.log_id, "p2": arg.executor_ids})


class AsyncQuerier:
    def __init__(self, conn: sqlalchemy.ext.asyncio.AsyncConnection):
        self._conn = conn

    async def batch_update_heartbeat_log(self, arg: BatchUpdateHeartbeatLogParams) -> None:
        await self._conn.execute(sqlalchemy.text(BATCH_UPDATE_HEARTBEAT_LOG), {"p1": arg.log_id, "p2": arg.executor_ids})
