package authcenter

import (
	"time"

	"github.com/tidbcloud/account/internel/dao/entity"
)

type CreateClusterUserParam struct {
	ClusterID            uint64
	ServerlessToken      string
	Username             string // not start with serverless token if the cluster is serverless cluster
	CredentialType       entity.CredentialType
	Credential           string
	TokenExpiredDuration time.Duration // if CredentialType is token, biz can set the token expired time
	BuiltinRole          string
	CustomRoles          []string
	Grants               string
	Description          string

	TargetType entity.ClusterUserTargetType
	UserEmail  string // is required if Username is the delegate user of cloud user
}

type ClusterUserInfo struct {
	ClusterUsername string
	CredentialType  entity.CredentialType
	Credential      string
}

type ClusterUserPriv struct {
	BuiltinRole string
	CustomRoles []string
	Grants      string
}

type ExistDBUser struct {
	Email    string
	Username *string
	JwtToken *string
}

type OperatorCandidate struct {
	TargetType entity.TargetType
	TargetID   uint64
	TargetVal  string
}

const (
	ErrMsgClusterNotExist                 = "cluster is not exist"
	ErrMsgOrgKeyNotExist                  = "org key is not exist"
	ErrMsgOperatorCandidatesEmpty         = "operator candidates is empty"
	ErrMsgNotFoundValidOperatorDbUsername = "not found valid operator dbUsername"
	ErrMsgNotFoundRoleAdminDbUser         = "not found role admin db user"
)
