package notify

import (
	"context"
	"time"
)

type Client interface {
	SetDefaultLink(func(message *Message))
	SetLink(string, func(*Message))
	send(msg TransferMsg) (WaitMsg, error)
	sendWait(msg TransferMsg, timeout time.Duration) (Message, error)
	Send(key string, value MsgVal) error
	SendWait(key string, value MsgVal, timeout time.Duration) (Message, error)
	SendWaitObj(key string, value interface{}, timeout time.Duration) (Message, error)
	SendCtx(ctx context.Context, key string, value MsgVal) (Message, error)
	Reply(m Message, value MsgVal) error
	ExchangeKey(newKey []byte) error
	Connect(network string, addr string) error
	ConnectTimeout(network string, addr string, timeout time.Duration) error
	SkipExchangeKey() bool
	SetSkipExchangeKey(bool)

	GetMsgEn() func([]byte, []byte) []byte
	SetMsgEn(func([]byte, []byte) []byte)
	GetMsgDe() func([]byte, []byte) []byte
	SetMsgDe(func([]byte, []byte) []byte)

	Heartbeat()
	HeartbeatPeroid() time.Duration
	SetHeartbeatPeroid(duration time.Duration)

	GetSecretKey() []byte
	SetSecretKey(key []byte)
	RsaPubKey() []byte
	SetRsaPubKey([]byte)

	Stop() error
	StopMonitorChan() <-chan struct{}
	Status() Status
	ShowError(bool)

	GetSequenceEn() func(interface{}) ([]byte, error)
	SetSequenceEn(func(interface{}) ([]byte, error))
	GetSequenceDe() func([]byte) (interface{}, error)
	SetSequenceDe(func([]byte) (interface{}, error))
	SendObjCtx(ctx context.Context, key string, val interface{}) (Message, error)
	SendObj(key string, val interface{}) error
}
