package activedirectory_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/activedirectory"
)

type ActiveDirectoryHealthCrawler struct {
	crawler.SocketHeahthCrawler
}

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

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

func NewActiveDirectoryHealthCrawler() *ActiveDirectoryHealthCrawler {
	ad := &ActiveDirectoryHealthCrawler{}
	ad.SetInternal(ad)
	ad.SetMatcher(activedirectory.NewActiveDirectoryMatcher())
	return ad
}
