package initialize

import (
	"context"

	"github.com/perfect-panel/server/internal/config"
	"github.com/perfect-panel/server/internal/svc"
	"github.com/perfect-panel/server/pkg/logger"
	"github.com/perfect-panel/server/pkg/tool"
)

func Signature(svc *svc.ServiceContext) {
	logger.Debug("Signature config initialization")
	configs, err := svc.SystemModel.GetSignatureConfig(context.Background())
	if err != nil {
		logger.Error("[Init Signature Config] Get Signature Config Error: ", logger.Field("error", err.Error()))
		return
	}
	var signatureConfig config.Signature
	tool.SystemConfigSliceReflectToStruct(configs, &signatureConfig)
	svc.Config.Signature = signatureConfig
}
