package event

import (
	"github.com/gookit/event"
	"gitlab.fjmaimaimai.com/allied-creation/character-library-metadata-bastion/pkg/domain"
)

func Start() {
	RegisterEvent()
}

func RegisterEvent() {
	event.On(domain.TableDataEditEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.TableDataImportEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.TableDeleteEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.QuerySetUpdateEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.QuerySetUpdateRenameEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.QuerySetUpdateStatusEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.TableApplyOnEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
	event.On(domain.QuerySetDeleteEvent.ToString(), event.ListenerFunc(tableDataChangeHandler), event.High)
}