package utils

const (
	minPassword = "6"
	MinPassword = 6
	maxPassword = "64"
	MaxPassword = 64

	LenHeaderXAuthorization    = 36
	lenHeaderXAuthorization    = "36"
	LenUserId                  = 36
	LenHeaderXApiKey           = 36
	LenHeaderBrowserTabSession = 36

	HeaderXAuthorization    = "X-Authorization"
	HeaderXApiKey           = "X-Api-Key"
	HeaderBrowserTabSession = "Browser-Tab-Session"

	SessionExpiresAtTime = 7 * 24 * 60 * 60 // 1 week

	MaxImageSize = 25 * 1024 * 1024 // 25MB
	MaxVideoSize = 50 * 1024 * 1024 // 50MB
)

var (
	AcceptedImageFileTypes = []string{
		"image/png",
		"image/jpeg",
		"image/jpg",
		"image/webp"}

	AcceptedVideoFileTypes = []string{
		"video/mp4",
		"video/webm",
		"video/mkv"}
)

const (
	LessonContentTypeHeader uint8 = 1
	LessonContentTypeText         = 2
	LessonContentTypeImage
)

const (
	PermissionTeamInviteNewTeamMember = 1
	PermissionTeamRemoveTeamMember    = 2
)

var Permissions = []uint16{
	PermissionTeamInviteNewTeamMember,
	PermissionTeamRemoveTeamMember,
}

const (
	RoleAdminId     = "d0f0fa0d-3f3b-438b-a76f-7febeb8aab57"
	RoleModeratorId = "b7359e12-359e-423b-b39c-f0d4069adebc"
	RoleUserId      = "a1f084ad-d501-4015-b326-4c5c46fd1c5e"
)

// Permissions for each role

var AdminPermissions = Permissions

var ModeratorPermissions = []uint16{
	PermissionTeamInviteNewTeamMember,
}

var UserPermissions = []uint16{}

var Roles = map[string][]uint16{
	RoleAdminId:     AdminPermissions,
	RoleModeratorId: ModeratorPermissions,
	RoleUserId:      UserPermissions,
}

// websocket

// commands sent to websocket clients
const (
	SendCmdSettingsUpdated          = 1
	SendCmdSettingsUpdatedLogo      = 2
	SendCmdSettingsUpdatedBanner    = 3
	SendCmdSettingsUpdatedSubdomain = 4
	SendCmdTeamAddedMember          = 5
)

// commands received from websocket clients
const (
	ReceivedCmdSubscribeToTopic = 1
)

const (
	SubscribedTopicLessons  = "/lessons"
	SubscribedTopicTeam     = "/team"
	SubscribedTopicRoles    = "/roles"
	SubscribedTopicSettings = "/settings"
	SubscribedTopicAccount  = "/account"
)
