package register_validator

import (
	"goskeleton/app/core/container"
	"goskeleton/app/global/consts"
	"goskeleton/app/http/validator/common/upload_files"
	"goskeleton/app/http/validator/common/websocket"
	"goskeleton/app/http/validator/web/ai_doc.go"
	"goskeleton/app/http/validator/web/ai_layout"
	"goskeleton/app/http/validator/web/ai_recognition"
	"goskeleton/app/http/validator/web/file"
	"goskeleton/app/http/validator/web/users"
)

// 各个业务模块验证器必须进行注册（初始化），程序启动时会自动加载到容器
func WebRegisterValidator() {
	//创建容器
	containers := container.CreateContainersFactory()

	//  key 按照前缀+模块+验证动作 格式，将各个模块验证注册在容器
	var key string
	// Users 模块表单验证器按照 key => value 形式注册在容器，方便路由模块中调用
	key = consts.ValidatorPrefix + "UsersRegister"
	containers.Set(key, users.Register{})
	key = consts.ValidatorPrefix + "UsersLogin"
	containers.Set(key, users.Login{})
	key = consts.ValidatorPrefix + "RefreshToken"
	containers.Set(key, users.RefreshToken{})

	// Users基本操作（CURD）
	key = consts.ValidatorPrefix + "UsersInfo"
	containers.Set(key, users.Info{})
	// key = consts.ValidatorPrefix + "UsersStore"
	// containers.Set(key, users.Store{})
	key = consts.ValidatorPrefix + "UsersNameUpdate"
	containers.Set(key, users.NameUpdate{})
	key = consts.ValidatorPrefix + "UsersPasswordUpdate"
	containers.Set(key, users.PasswordUpdate{})
	key = consts.ValidatorPrefix + "UsersDestroy"
	containers.Set(key, users.Destroy{})
	key = consts.ValidatorPrefix + "UsersLogout"
	containers.Set(key, users.Logout{})
	key = consts.ValidatorPrefix + "PublicKey"
	containers.Set(key, users.PublicKey{})

	// 文件上传
	key = consts.ValidatorPrefix + "UploadFiles"
	containers.Set(key, upload_files.UpFiles{})

	// Websocket 连接验证器
	key = consts.ValidatorPrefix + "WebsocketConnect"
	containers.Set(key, websocket.Connect{})

	// ai 识别功能相关
	key = consts.ValidatorPrefix + "PicRecognition"
	containers.Set(key, ai_recognition.PicRecognition{})
	key = consts.ValidatorPrefix + "VocRecognition"
	containers.Set(key, ai_recognition.VocRecognition{})
	// ai文档优化
	key = consts.ValidatorPrefix + "DocRefine"
	containers.Set(key, ai_doc.DocRefine{})
	// ai 排版
	key = consts.ValidatorPrefix + "StyleGenerate"
	containers.Set(key, ai_layout.StyleGenerate{})
	key = consts.ValidatorPrefix + "LayoutGenerate"
	containers.Set(key, ai_layout.LayoutGenerate{})

	//文件相关操作
	//创建文件
	key = consts.ValidatorPrefix + "FileCreat"
	containers.Set(key, file.FileCreat{})
	//创建文件夹
	key = consts.ValidatorPrefix + "FolderCreat"
	containers.Set(key, file.FolderCreat{})
	//打开文件
	key = consts.ValidatorPrefix + "FileGet"
	containers.Set(key, file.FileGet{})
	//文件重命名
	key = consts.ValidatorPrefix + "FileRename"
	containers.Set(key, file.FileRename{})
	//移动文件
	key = consts.ValidatorPrefix + "FileMove"
	containers.Set(key, file.FileMove{})
	//保存文件
	key = consts.ValidatorPrefix + "FileSave"
	containers.Set(key, file.FileSave{})
	//删除文件
	key = consts.ValidatorPrefix + "FileDelete"
	containers.Set(key, file.FileDelete{})

}
