package initial

import (
	"git.gocasts.ir/ebhomengo/niki/adapter/redis"
	"git.gocasts.ir/ebhomengo/niki/config"
	"git.gocasts.ir/ebhomengo/niki/repository/mysql"
	mysqlkindboxreq "git.gocasts.ir/ebhomengo/niki/repository/mysql/kind_box_req"
	adminvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/admin"
	adminkindboxreqvalidator "git.gocasts.ir/ebhomengo/niki/validator/admin/kind_box_req"
	benefactoraddressvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/address"
	benefactorvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/benefactor"
	benefactorkindboxreqvalidator "git.gocasts.ir/ebhomengo/niki/validator/benefactor/kind_box_req"
)

type Validators struct {
	BenefactorVld           benefactorvalidator.Validator
	BenefactorKindBoxReqVld benefactorkindboxreqvalidator.Validator
	BenefactorAddressVld    benefactoraddressvalidator.Validator
	AdminKindBoxReqVld      adminkindboxreqvalidator.Validator
	AdminVld                adminvalidator.Validator
}

func InitAdminKindBoxReqValidator(db *mysql.DB) adminkindboxreqvalidator.Validator {
	return adminkindboxreqvalidator.New(InitBenefactorKindBoxReqDB(db))
}

func InitAdminValidator(db *mysql.DB) adminvalidator.Validator {
	return adminvalidator.New(InitAdminMysql(db))
}

func InitBenefactorValidator() benefactorvalidator.Validator {
	return benefactorvalidator.New()
}

func InitBenefactorKindBoxReqValidator(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactorkindboxreqvalidator.Validator {
	return benefactorkindboxreqvalidator.New(
		mysqlkindboxreq.New(db),
		InitBenefactorService(cfg, redisAdapter, db),
		InitBenefactorAddressService(db),
	)
}

func InitBenefactorAddressValidator(cfg config.Config, redisAdapter redis.Adapter, db *mysql.DB) benefactoraddressvalidator.Validator {
	return benefactoraddressvalidator.New(
		InitBenefactorService(cfg, redisAdapter, db),
		InitBenefactorAddressDB(db),
	)
}
