// Code generated by FTL. DO NOT EDIT.
package postgres

import (
	"context"
	ftldb "ftl/postgres/db"
	"github.com/block/ftl/common/reflection"
	"github.com/block/ftl/go-runtime/ftl"
	"github.com/block/ftl/go-runtime/server"
)

type InsertClient func(context.Context, InsertRequest) (InsertResponse, error)

type TransactionInsertClient func(context.Context, TransactionRequest) (TransactionResponse, error)

type TransactionRollbackClient func(context.Context, TransactionRequest) (TransactionResponse, error)

//ftl:database postgres testdb
type TestdbConfig struct{}

type TestdbHandle = ftl.DatabaseHandle[TestdbConfig]

func init() {
	reflection.Register(
		reflection.Database[TestdbConfig]("testdb", server.InitPostgres),

		reflection.ProvideResourcesForVerb(
			Insert,
			server.DatabaseHandle[TestdbConfig]("testdb", "postgres"),
		),

		reflection.Transaction(TransactionInsert, "testdb"),

		reflection.ProvideResourcesForVerb(
			TransactionInsert,
			server.SinkClient[ftldb.CreateRequestClient, ftl.Option[string]](),
			server.SourceClient[ftldb.GetRequestDataClient, []ftl.Option[string]](),
		),

		reflection.Transaction(TransactionRollback, "testdb"),

		reflection.ProvideResourcesForVerb(
			TransactionRollback,
			server.SinkClient[ftldb.CreateRequestClient, ftl.Option[string]](),
		),
	)
}
