package model

import "iot_manager_service/app/system/dao"

type Token struct {
	TenantId     string
	UserName     string
	Password     string
	GrantType    string
	RefreshToken string
	UserType     string
}

type UserInfo struct {
	*dao.User            //用户基础信息
	Permissions []string //权限标识集合
	Roles       []string //角色集合
	OauthId     string   //第三方授权id
}

type RspToken struct {
	TenantId     string `json:"tenant_id"`
	UserId       int64  `json:"user_id"`
	RoleId       int64  `json:"role_id"`
	OauthId      string `json:"oauth_id"`
	Account      string `json:"account"`
	UserName     string `json:"user_name"`
	NickName     string `json:"nick_name"`
	RoleName     string `json:"role_name"`
	Avatar       string `json:"avatar"`
	AccessToken  string `json:"access_token"`
	RefreshToken string `json:"refresh_token"`
	TokenType    string `json:"token_type"`
	ExpiresIn    int    `json:"expires_in"`
	License      string `json:"license"`
}

type RspCaptcha struct {
	Key   string `json:"key"`
	Image string `json:"image"`
}

type RspLogin struct {
	ID            string `json:"id"`
	Name          string `json:"name"`
	BackgroundUrl string `json:"backgroundUrl"`
	SysLogoUrl    string `json:"sysLogoUrl"`
}

// JWT
const (
	Iss       = "iss"
	Aud       = "aud"
	TenantId  = "tenant_id"
	RoleName  = "role_name"
	PostId    = "post_id"
	UserId    = "user_id"
	RoleId    = "role_id"
	UserName  = "user_name"
	OauthID   = "oauth_id"
	NickName  = "nick_name"
	TokenType = "token_type"
	DeptId    = "dept_id"
	Account   = "account"
	ClientId  = "client_id"
	Exp       = "exp"
	Nbf       = "nbf"
	BEARER    = "bearer"

	AccessToken  = "access_token"
	RefreshToken = "refresh_token"
	Saber        = "saber"
)

const (
	CaptchaHeaderKey          = "Captcha-Key"
	CaptchaHeaderCode         = "Captcha-Code"
	CaptchaNotCorrect         = "验证码不正确"
	UserTypeHeaderKey         = "User-Type"
	UserNotFound              = "用户名或密码错误"
	UserHasNoRole             = "未获得用户的角色信息"
	TenantNotFound            = "请输入专属登录地址！"
	UserHasNoTenant           = "未获得用户的租户信息"
	UserHasNoTenantPermission = "租户授权已过期,请联系管理员"
	HeaderKey                 = "Authorization"
	HEADER_PREFIX             = "Basic "
	DEFAULT_AVATAR            = "https://gw.alipayobjects.com/zos/rmsportal/BiazfanxmamNRoxxVxka.png"
)
