package factory

import (
	"github.com/linmadan/egglib-go/transaction/pg"
	"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/dao"
)

func CreateTaskDao(options map[string]interface{}) (*dao.TaskDao, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return dao.NewTaskDao(transactionContext)
}

func CreateEmployeeDao(options map[string]interface{}) (*dao.EmployeeDao, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return dao.NewEmployeeDao(transactionContext)
}

func CreateNotificationDao(options map[string]interface{}) (*dao.NotificationDao, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return dao.NewNotificationDao(transactionContext)
}

func CreateCashPoolDao(options map[string]interface{}) (*dao.CashPoolDao, error) {
	var transactionContext *pg.TransactionContext
	if value, ok := options["transactionContext"]; ok {
		transactionContext = value.(*pg.TransactionContext)
	}
	return dao.NewCashPoolDao(transactionContext)
}