# Code generated by sqlc. DO NOT EDIT.
# versions:
#   sqlc v1.29.0
# source: _10_create_workflow_run_table.sql
import dataclasses

import sqlalchemy
import sqlalchemy.ext.asyncio

from . import models


CREATE_WORKFLOW_RUN_TABLE = """-- name: create_workflow_run_table \\:exec
CREATE TABLE IF NOT EXISTS hyrex_workflow_run (
    id              UUID                        NOT NULL PRIMARY KEY,
    parent_id       UUID,
    workflow_name   VARCHAR                     NOT NULL,
    args            JSON                        NOT NULL,
    queue           VARCHAR                     NOT NULL,
    timeout_seconds INT                         DEFAULT NULL CHECK (timeout_seconds IS NULL OR timeout_seconds > 0),
    status          workflow_run_status             NOT NULL,
    scheduled_start TIMESTAMP WITH TIME ZONE,
    queued          TIMESTAMP WITH TIME ZONE,
    started         TIMESTAMP WITH TIME ZONE,
    finished        TIMESTAMP WITH TIME ZONE,
    last_heartbeat  TIMESTAMP WITH TIME ZONE,
    idempotency_key VARCHAR
)
"""


@dataclasses.dataclass()
class CreateWorkflowRunTableParams:

    pass

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

    def create_workflow_run_table(self, arg: CreateWorkflowRunTableParams) -> None:
        self._conn.execute(sqlalchemy.text(CREATE_WORKFLOW_RUN_TABLE))


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

    async def create_workflow_run_table(self, arg: CreateWorkflowRunTableParams) -> None:
        await self._conn.execute(sqlalchemy.text(CREATE_WORKFLOW_RUN_TABLE))
