package main

import (
	
	

	

	amhelp 
	am 
	ampipe 
)

func init() {
	// load .env
	_ = godotenv.Load()

	// am-dbg is required for debugging, go run it
	// go run github.com/pancsta/asyncmachine-go/tools/cmd/am-dbg@latest
	// amhelp.EnableDebugging(false)
	// amhelp.SetEnvLogLevel(am.LogOps)
}

func main() {
	 := context.Background()

	// init state machines
	 := am.New(, am.Schema{
		"Ready":       {},
		"Foo":         {},
		"Bar":         {},
		"Custom":      {},
		"Healthcheck": {Multi: true},
	}, &am.Opts{LogLevel: am.LogOps, Id: "source"})
	 := am.New(, am.Schema{
		"Ready":       {},
		"Custom":      {},
		"Healthcheck": {Multi: true},
	}, &am.Opts{LogLevel: am.LogOps, Id: "destination"})
	amhelp.MachDebugEnv()
	amhelp.MachDebugEnv()

	// pipe conventional states
	 := ampipe.BindReady(, , "", "")
	if  != nil {
		panic()
	}
	 = ampipe.BindErr(, , "")
	if  != nil {
		panic()
	}

	// pipe custom states (anon handlers)
	 := &struct {
		 am.HandlerFinal
		   am.HandlerFinal
	}{
		: ampipe.Add(, , "Custom", ""),
		:   ampipe.Remove(, , "Custom", ""),
	}

	// bind and handle dispose
	if  := .BindHandlers();  != nil {
		panic()
	}

	// debug
	time.Sleep(time.Second)
}