package plugin

type ProtocolHandler interface {
	Name() string
	Connect(config map[string]interface{}) (Session, error)
	Disconnect(sessionID string) error
}

type Session interface {
	ID() string
	Protocol() string
	Write(data []byte) error
	Close() error
}

type Importer interface {
	Name() string
	FileExtensions() []string
	Parse(data []byte) (*ImportResult, error)
}

type ImportResult struct {
	Groups      []ImportGroup      `json:"groups"`
	Connections []ImportConnection `json:"connections"`
	HostKeys    []ImportHostKey    `json:"hostKeys"`
	Theme       *ImportTheme       `json:"theme,omitempty"`
}

type ImportGroup struct {
	Name       string `json:"name"`
	ParentName string `json:"parentName,omitempty"`
}

type ImportConnection struct {
	Name      string `json:"name"`
	Hostname  string `json:"hostname"`
	Port      int    `json:"port"`
	Protocol  string `json:"protocol"`
	Username  string `json:"username"`
	GroupName string `json:"groupName"`
	Notes     string `json:"notes"`
}

type ImportHostKey struct {
	Hostname    string `json:"hostname"`
	Port        int    `json:"port"`
	KeyType     string `json:"keyType"`
	Fingerprint string `json:"fingerprint"`
}

type ImportTheme struct {
	Name       string     `json:"name"`
	Foreground string     `json:"foreground"`
	Background string     `json:"background"`
	Cursor     string     `json:"cursor"`
	Colors     [16]string `json:"colors"`
}
