package code

import (
	_ "embed"

	"bindbox-game/configs"
)

//go:embed code.go
var ByteCodeFile []byte

// Failure 错误时返回结构
type Failure struct {
	Code    int    `json:"code"`    // 业务码
	Message string `json:"message"` // 描述信息
}

const (
	ServerError        = 10101
	ParamBindError     = 10102
	JWTAuthVerifyError = 10103
	UploadError        = 10104
	ForbiddenError     = 10105
	AuthorizationError = 10106

	AdminLoginError  = 20101
	CreateAdminError = 20207
	ListAdminError   = 20208
	ModifyAdminError = 20209
	DeleteAdminError = 20210
)

func Text(code int) string {
	lang := configs.Get().Language.Local

	if lang == configs.ZhCN {
		return zhCNText[code]
	}

	return zhCNText[code]
}

const (
	CreateActivityError      = 20501
	ModifyActivityError      = 20502
	DeleteActivityError      = 20503
	GetActivityError         = 20504
	ListActivitiesError      = 20505
	ListActivityIssuesError  = 20506
	CreateActivityIssueError = 20507
	ModifyActivityIssueError = 20508
	DeleteActivityIssueError = 20509
	CreateIssueRewardsError  = 20510
	ListIssueRewardsError    = 20511
	ListDrawLogsError        = 20512
	CreateUserError          = 20516
	DeleteUserError          = 20517
)

const (
	CreateGuildError      = 20601
	ModifyGuildError      = 20602
	DeleteGuildError      = 20603
	GetGuildError         = 20604
	ListGuildsError       = 20605
	ListGuildMembersError = 20606
	JoinGuildError        = 20607
	LeaveGuildError       = 20608
)
