package cassandra_protocol_crawler

import (
	"encoding/json"
	config "git.loafle.net/overflow/overflow_probe/agent_api/config_manager"
	"git.loafle.net/overflow/overflow_probe/crawler"
	"git.loafle.net/overflow/overflow_probe/matcher/cassandra"
)

type CassandraHealthCrawler struct {
	crawler.SocketHeahthCrawler
}

func (r *CassandraHealthCrawler) Internal(params config.Config) ([]byte, error) {

	b, err := r.CheckHeahth(params)
	if err != nil {
		return nil, err
	}
	return json.Marshal(b)
}

func NewCassandraHealthCrawler() *CassandraHealthCrawler {
	r := &CassandraHealthCrawler{}
	r.SetInternal(r)
	r.SetMatcher(cassandra.NewCassandraMatcher())
	return r
}
