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

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


SKIP_WAITING_TASK_FOR_WORKFLOW_RUN_ID = """-- name: skip_waiting_task_for_workflow_run_id \\:exec
UPDATE hyrex_task_run
SET status   = 'SKIPPED'\\:\\:task_run_status,
    finished = CURRENT_TIMESTAMP
WHERE status = 'AWAIT_DEPS'
  AND workflow_run_id = :p1
"""


@dataclasses.dataclass()
class SkipWaitingTaskForWorkflowRunIdParams:
    workflow_run_id: Optional[uuid.UUID]


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

    def skip_waiting_task_for_workflow_run_id(self, arg: SkipWaitingTaskForWorkflowRunIdParams) -> None:
        self._conn.execute(sqlalchemy.text(SKIP_WAITING_TASK_FOR_WORKFLOW_RUN_ID), {"p1": arg.workflow_run_id})


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

    async def skip_waiting_task_for_workflow_run_id(self, arg: SkipWaitingTaskForWorkflowRunIdParams) -> None:
        await self._conn.execute(sqlalchemy.text(SKIP_WAITING_TASK_FOR_WORKFLOW_RUN_ID), {"p1": arg.workflow_run_id})
