package simple

import (
	"be.ems/src/framework/cron"
	"be.ems/src/framework/logger"
)

var NewProcessor = &simpleProcessor{}

// simple 队列任务处理
type simpleProcessor struct{}

func (s *simpleProcessor) Execute(data any) (any, error) {
	options := data.(cron.JobData)

	sysJob := options.SysJob
	logger.Infof("重复 %v 任务ID %d", options.Repeat, sysJob.JobId)

	// 返回结果，用于记录执行结果
	result := map[string]any{
		"repeat":       options.Repeat,
		"jobName":      sysJob.JobName,
		"invokeTarget": sysJob.InvokeTarget,
		"targetParams": sysJob.TargetParams,
	}
	return result, nil
}
