package domain

import (
	"fmt"
	"strings"

	ers "backend/pkg/library/errs"
	"backend/pkg/library/errs/code"

	"github.com/zeromicro/go-zero/core/logx"
)

func ThirdPartyError(scope uint32, ec ers.ErrorCode, s ...string) *ers.LibError {
	return ers.NewError(scope, code.ThirdParty, ec.ToUint32(), fmt.Sprintf("thirty error: %s", strings.Join(s, " ")))
}

func ThirdPartyErrorL(scope uint32, ec ers.ErrorCode,
	l logx.Logger, filed []logx.LogField, s ...string) *ers.LibError {
	e := ThirdPartyError(scope, ec, s...)
	l.WithCallerSkip(1).WithFields(filed...).Error(e.Error())

	return e
}

const (
	NotificationErrorCode = 1 + iota
	FailedToSendEmailErrorCode
	FailedToSendSMSErrorCode
)
