package mysql

import (
	"context"
	"time"
)

type Command string

const (
	CommandPing      Command = "ping"
	CommandCheckConn Command = "checkConn"
)

type Action struct {
	Command        Command    `json:"command"`
	DataSourceName string     `json:"dsn"`
	TLS            *TLSConfig `json:"tls,omitempty"`

	Timeout time.Duration `json:"timeout"`
}

type TLSConfig struct {
	CA   []byte `json:"ca"`
	Cert []byte `json:"cert"`
	Key  []byte `json:"key"`
}

type Invoker interface {
	Invoke(ctx context.Context, ac *Action) error
}
