package bootstrap

import (
	"github.com/break/junhong_cmp_fiber/internal/handler/admin"
	"github.com/break/junhong_cmp_fiber/internal/handler/app"
	authHandler "github.com/break/junhong_cmp_fiber/internal/handler/auth"
	"github.com/break/junhong_cmp_fiber/internal/handler/callback"
	"github.com/break/junhong_cmp_fiber/internal/handler/h5"
	"github.com/go-playground/validator/v10"
)

func initHandlers(svc *services, deps *Dependencies) *Handlers {
	validate := validator.New()

	return &Handlers{
		Auth:                        authHandler.NewHandler(svc.Auth, validate),
		Account:                     admin.NewAccountHandler(svc.Account),
		Role:                        admin.NewRoleHandler(svc.Role, validate),
		Permission:                  admin.NewPermissionHandler(svc.Permission),
		PersonalCustomer:            app.NewPersonalCustomerHandler(svc.PersonalCustomer, deps.Logger),
		Shop:                        admin.NewShopHandler(svc.Shop),
		AdminAuth:                   admin.NewAuthHandler(svc.Auth, validate),
		H5Auth:                      h5.NewAuthHandler(svc.Auth, validate),
		ShopCommission:              admin.NewShopCommissionHandler(svc.ShopCommission),
		CommissionWithdrawal:        admin.NewCommissionWithdrawalHandler(svc.CommissionWithdrawal),
		CommissionWithdrawalSetting: admin.NewCommissionWithdrawalSettingHandler(svc.CommissionWithdrawalSetting),
		Enterprise:                  admin.NewEnterpriseHandler(svc.Enterprise),
		EnterpriseCard:              admin.NewEnterpriseCardHandler(svc.EnterpriseCard),
		EnterpriseDevice:            admin.NewEnterpriseDeviceHandler(svc.EnterpriseDevice),
		EnterpriseDeviceH5:          h5.NewEnterpriseDeviceHandler(svc.EnterpriseDevice),
		Authorization:               admin.NewAuthorizationHandler(svc.Authorization),
		MyCommission:                admin.NewMyCommissionHandler(svc.MyCommission),
		IotCard:                     admin.NewIotCardHandler(svc.IotCard, deps.GatewayClient),
		IotCardImport:               admin.NewIotCardImportHandler(svc.IotCardImport),
		Device:                      admin.NewDeviceHandler(svc.Device, deps.GatewayClient),
		DeviceImport:                admin.NewDeviceImportHandler(svc.DeviceImport),
		AssetAllocationRecord:       admin.NewAssetAllocationRecordHandler(svc.AssetAllocationRecord),
		Storage:                     admin.NewStorageHandler(deps.StorageService),
		Carrier:                     admin.NewCarrierHandler(svc.Carrier),
		PackageSeries:               admin.NewPackageSeriesHandler(svc.PackageSeries),
		Package:                     admin.NewPackageHandler(svc.Package),
		ShopSeriesAllocation:        admin.NewShopSeriesAllocationHandler(svc.ShopSeriesAllocation),
		ShopPackageAllocation:       admin.NewShopPackageAllocationHandler(svc.ShopPackageAllocation),
		ShopPackageBatchAllocation:  admin.NewShopPackageBatchAllocationHandler(svc.ShopPackageBatchAllocation),
		ShopPackageBatchPricing:     admin.NewShopPackageBatchPricingHandler(svc.ShopPackageBatchPricing),
		AdminOrder:                  admin.NewOrderHandler(svc.Order),
		H5Order:                     h5.NewOrderHandler(svc.Order),
		H5Recharge:                  h5.NewRechargeHandler(svc.Recharge),
		PaymentCallback:             callback.NewPaymentHandler(svc.Order, svc.Recharge, deps.WechatPayment),
	}
}
